public class RepositoryUrlFragment extends Object
This class only works with paths that begin with:
This class captures any path suffix
that did not describe the repository but still may be
useful to identify.
Modifier and Type | Method and Description |
---|---|
static RepositoryUrlFragment |
fromKeyAndSlug(String projectKey,
String repositorySlug) |
static RepositoryUrlFragment |
fromNamespacedPathInfo(String pathInfo)
Deprecated.
in 7.18 for removal without replacement in 9.0
|
static RepositoryUrlFragment |
fromPathInfo(String pathInfo)
Extracts the repository URL fragment from the given path info.
|
static RepositoryUrlFragment |
fromRepository(com.atlassian.bitbucket.repository.Repository repository) |
String |
getPathSuffix() |
String |
getProjectKey() |
String |
getProjectNamespace()
Deprecated.
in 7.18 for removal without replacement in 9.0
|
String |
getRepositorySlug() |
String |
toPath(String basePath)
Formats this fragment as a path suitable for use with a
URI , such as with URI.resolve(String) ,
optionally pre-pending a provided base path. |
String |
toPath(String basePath,
boolean includeSuffix)
Formats this fragment as a path suitable for use with a
URI , such as with URI.resolve(String) ,
optionally pre-pending a provided base path. |
String |
toString() |
@Nullable public static RepositoryUrlFragment fromPathInfo(@Nonnull String pathInfo)
pathInfo
- the path info as provided by the HttpServletRequest.getPathInfo()
method.NullPointerException
- if the path info is null@Deprecated @Nullable public static RepositoryUrlFragment fromNamespacedPathInfo(@Nonnull String pathInfo)
pathInfo
- the path info as provided by the HttpServletRequest.getPathInfo()
method.NullPointerException
- if the path info is null@Nonnull public static RepositoryUrlFragment fromRepository(@Nonnull com.atlassian.bitbucket.repository.Repository repository)
repository
- the repository to create a fragment for@Nonnull public static RepositoryUrlFragment fromKeyAndSlug(@Nonnull String projectKey, @Nonnull String repositorySlug)
projectKey
- the project key to userepositorySlug
- the repository slug to use@Nullable public String getPathSuffix()
@Deprecated @Nullable public String getProjectNamespace()
@Nonnull public String toPath(@Nullable String basePath)
URI
, such as with URI.resolve(String)
,
optionally pre-pending a provided base path. The path suffix
nor the .git
extension if present in the original path are output here.basePath
- the base path to prepend, or null
@Nonnull public String toPath(@Nullable String basePath, boolean includeSuffix)
URI
, such as with URI.resolve(String)
,
optionally pre-pending a provided base path. The path suffix
is included if
the includeSuffix
parameter is true
.basePath
- the base path to prepend, or null
includeSuffix
- whether to include the suffixCopyright © 2024 Atlassian. All rights reserved.