public final class UniformPath extends java.lang.Object implements java.lang.Comparable<UniformPath>, java.io.Serializable
UniformPath.EType
).
Never includes a project or repository name.
Use UniformPathCompatibilityUtil
to create UniformPath
instances from String
representations.Modifier and Type | Class and Description |
---|---|
static class |
UniformPath.EType
All types a path can have.
|
Modifier and Type | Field and Description |
---|---|
protected static java.lang.String |
SEGMENTS_PROPERTY
The name of the JSON property name for
segments . |
protected static java.lang.String |
TYPE_PROPERTY
The name of the JSON property name for
type . |
Modifier and Type | Method and Description |
---|---|
static UniformPath |
codeRoot()
Returns the code type root path.
|
int |
compareTo(UniformPath other) |
boolean |
equals(java.lang.Object obj) |
static java.lang.String |
escapeSegment(java.lang.String segment)
Escapes uniform path separators in a segment.
|
java.lang.String |
getLastSegment()
Returns the name of the last segment (directory or file) of this path.
|
UniformPath |
getParent()
Returns the parent of this path, i.e.
|
RelativeUniformPath |
getSubPath(int numberOfTopLevelSegmentsToRemove)
Returns the sub path relative to the given number of top level path segments.
|
RelativeUniformPath |
getSubPathAfter(java.lang.String segment)
Returns the relative sub path after the given segment.
|
boolean |
hasAncestor(UniformPath ancestorPath)
Returns whether the ancestorPath contains this path as a subpath.
|
boolean |
hasDescendant(UniformPath descendantPath)
Returns whether this path contains the descendantPath as a subpath.
|
int |
hashCode() |
boolean |
isArchitecturePath()
Returns whether this path is an architecture path
|
boolean |
isCodePath()
Returns whether this path is a (regular) code path
|
boolean |
isIssuePath()
Returns whether this path is an issue path
|
boolean |
isNonCodePath()
Returns whether this path is a non-code path
|
boolean |
isRoot()
Returns whether this is a root path.
|
boolean |
isTestPath()
Returns whether this path is a test execution path
|
static boolean |
isValidPath(java.lang.String uniformPath)
Checks whether the given uniform path is valid or not.
|
static UniformPath |
of(java.util.List<java.lang.String> segments)
Builds a path from the given segments.
|
static UniformPath |
of(java.lang.String... segments)
Builds a path from the given segments.
|
static UniformPath |
of(UniformPath.EType type,
java.util.List<java.lang.String> segments)
Builds a path from the given segments.
|
static UniformPath |
of(UniformPath.EType type,
java.lang.String... segments)
Builds a path from the given segments.
|
UniformPath |
resolve(RelativeUniformPath relativePath)
Resolves the given relative path against this absolute path, performing path
canonicalization in the process (i.e.
|
static UniformPath |
testRoot()
Returns the test type root path.
|
java.lang.String |
toString() |
java.lang.String |
urlEncode()
Returns this uniform path in url encoding (as needed for safely using it in
teamscale URLs).
|
protected static final java.lang.String TYPE_PROPERTY
type
.protected static final java.lang.String SEGMENTS_PROPERTY
segments
.public static UniformPath of(java.lang.String... segments)
of(List)
public static UniformPath of(UniformPath.EType type, java.lang.String... segments)
of(List)
public static UniformPath of(UniformPath.EType type, java.util.List<java.lang.String> segments)
of(List)
public static UniformPath of(java.util.List<java.lang.String> segments)
public static UniformPath codeRoot()
public static UniformPath testRoot()
public static java.lang.String escapeSegment(java.lang.String segment)
public UniformPath getParent()
public java.lang.String getLastSegment()
public RelativeUniformPath getSubPath(int numberOfTopLevelSegmentsToRemove)
Example: Removing two segments from src/main/java/Class.java
will
yield the relative path java/Class.java
.
public RelativeUniformPath getSubPathAfter(java.lang.String segment)
Example: The subpath after java
in src/main/java/Class.java
will yield the relative path Class.java
.
public static boolean isValidPath(java.lang.String uniformPath)
public boolean isRoot()
public boolean isCodePath()
public boolean isNonCodePath()
public boolean isArchitecturePath()
public boolean isIssuePath()
public boolean isTestPath()
public UniformPath resolve(RelativeUniformPath relativePath)
public boolean hasAncestor(UniformPath ancestorPath)
src
is an ancestor of src/main
.public boolean hasDescendant(UniformPath descendantPath)
/src/main
is a descendant of /src
.public java.lang.String toString()
toString
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object
public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
public int compareTo(UniformPath other)
compareTo
in interface java.lang.Comparable<UniformPath>
public java.lang.String urlEncode()