@Immutable public class RootPath extends AbstractPath
Path that serves as the root path.Path.Segment| Modifier and Type | Field and Description |
|---|---|
static Path |
INSTANCE |
EMPTY_PATH_ITERATOR, SELF_PATHDEFAULT_DECODER, DEFAULT_ENCODER, DEFAULT_INDEX, DELIMITER, DELIMITER_STR, IDENTIFIER_LEADING_TERMINAL, IDENTIFIER_TRAILING_TERMINAL, JSR283_DECODER, JSR283_ENCODER, NO_OP_DECODER, NO_OP_ENCODER, PARENT, PARENT_NAME, PARENT_SEGMENT, ROOT_NAME, ROOT_PATH, SELF, SELF_NAME, SELF_SEGMENT, URL_DECODER, URL_ENCODER| Modifier and Type | Method and Description |
|---|---|
int |
compareTo(Path other) |
boolean |
endsWith(Name nameOfLastSegment)
Determine if the path's
Path.getLastSegment() has the supplied name and no SNS index. |
boolean |
endsWith(Name nameOfLastSegment,
int snsIndex)
Determine if the path's
Path.getLastSegment() has the supplied name and SNS index. |
boolean |
equals(Object obj) |
Path |
getAncestor(int degree)
Return the path to the ancestor of the supplied degree.
|
Path |
getCanonicalPath()
Get the canonical form of this path.
|
Path |
getCommonAncestor(Path that)
Find the lowest common ancestor of this path and the supplied path.
|
Path.Segment |
getLastSegment()
Get the last segment in this path.
|
Path |
getNormalizedPath()
Get a normalized path with as many ".." segments and all "." resolved.
|
Path |
getParent()
Return the path to the parent, or this path if it is the
root. |
Path.Segment |
getSegment(int index)
Get the segment at the supplied index.
|
Path.Segment[] |
getSegmentsArray()
Obtain a copy of the segments in this path.
|
List<Path.Segment> |
getSegmentsList()
Get an unmodifiable list of the path segments.
|
protected Iterator<Path.Segment> |
getSegmentsOfParent()
Method used by
AbstractPath.equals(Object) implementation to quickly get an Iterator over the segments in the
parent. |
String |
getString()
Get the string form of the object.
|
String |
getString(NamespaceRegistry namespaceRegistry)
Get the string form of the object, using the supplied namespace registry to convert any namespace URIs to prefixes.
|
String |
getString(NamespaceRegistry namespaceRegistry,
TextEncoder encoder)
Get the encoded string form of the object, using the supplied namespace registry to convert the any namespace URIs to
prefixes.
|
String |
getString(NamespaceRegistry namespaceRegistry,
TextEncoder encoder,
TextEncoder delimiterEncoder)
Get the encoded string form of the object, using the supplied namespace registry to convert the names' namespace URIs to
prefixes and the supplied encoder to encode characters, and using the second delimiter to encode (or convert) the delimiter
used between the namespace prefix and the local part of any names.
|
String |
getString(TextEncoder encoder)
Get the encoded string form of the object, using the supplied encoder to encode characters.
|
int |
hashCode() |
boolean |
hasSameAncestor(Path that)
Determine whether this path and the supplied path have the same immediate ancestor.
|
boolean |
isAbsolute()
Return whether this path is an absolute path.
|
boolean |
isAncestorOf(Path descendant)
Determine whether this path is an ancestor of the supplied path.
|
boolean |
isAtOrAbove(Path other)
Determine whether this path is the
same as to or a ancestor of the
supplied path. |
boolean |
isAtOrBelow(Path other)
Determine whether this path is the
same as to or a descendant of the
supplied path. |
boolean |
isDescendantOf(Path ancestor)
Determine whether this path is an descendant of the supplied path.
|
boolean |
isNormalized()
Return whether this path is normalized and contains no unnecessary "." segments and as few ".." segments as possible.
|
boolean |
isRoot()
Return whether this path represents the root path.
|
boolean |
isSameAs(Path other)
Determine whether this path represents the same as the supplied path.
|
Iterator<Path.Segment> |
iterator() |
Iterator<Path> |
pathsFromRoot()
Return an iterator that walks the paths from the root path down to this path.
|
Path |
relativeToRoot()
Obtain a path that is relative to the root node.
|
Path |
resolve(Path relativePath)
Get the absolute path by resolving the supplied relative (non-absolute) path against this absolute path.
|
int |
size()
Return the number of segments in this path.
|
Path |
subpath(int beginIndex)
Return a new path consisting of the segments starting at
beginIndex index (inclusive). |
Path |
subpath(int beginIndex,
int endIndex)
Return a new path consisting of the segments between the
beginIndex index (inclusive) and the endIndex
index (exclusive). |
createSegmentsSubList, doGetString, isIdentifier, isNormalized, relativeTo, resolveAgainst, toStringclone, finalize, getClass, notify, notifyAll, wait, wait, waitforEach, spliteratorpublic static final Path INSTANCE
public Path getAncestor(int degree)
Pathx is the path that is x
levels up along the path. For example, degree = 0 returns this path, while degree = 1
returns the parent of this path, degree = 2 returns the grandparent of this path, and so on. Note that the
result may be unexpected if this path is not normalized, as a non-normalized path contains ".." and
"." segments.protected Iterator<Path.Segment> getSegmentsOfParent()
AbstractPathAbstractPath.equals(Object) implementation to quickly get an Iterator over the segments in the
parent.getSegmentsOfParent in class AbstractPathpublic Path getCanonicalPath()
Pathabsolute and Path.isNormalized().getCanonicalPath in interface PathgetCanonicalPath in class AbstractPathpublic Path getCommonAncestor(Path that)
PathgetCommonAncestor in interface PathgetCommonAncestor in class AbstractPaththat - the other pathpublic Path.Segment getLastSegment()
PathgetLastSegment in interface PathgetLastSegment in class AbstractPathpublic boolean endsWith(Name nameOfLastSegment)
PathPath.getLastSegment() has the supplied name and no SNS index.endsWith in interface PathendsWith in class AbstractPathnameOfLastSegment - the namepublic boolean endsWith(Name nameOfLastSegment, int snsIndex)
PathPath.getLastSegment() has the supplied name and SNS index.endsWith in interface PathendsWith in class AbstractPathnameOfLastSegment - the namesnsIndex - the SNS indexpublic Path getNormalizedPath()
PathgetNormalizedPath in interface PathgetNormalizedPath in class AbstractPathpublic Path relativeToRoot()
PathPath.relativeTo(Path) with the root
path.relativeToRoot in interface PathrelativeToRoot in class AbstractPathpublic Path resolve(Path relativePath)
Pathresolve in interface Pathresolve in class AbstractPathrelativePath - the relative path that is to be resolved against this pathpublic Path getParent()
Pathroot. This is an efficient operation that does
not require copying any data.getParent in interface PathgetParent in class AbstractPathpublic Path.Segment getSegment(int index)
PathgetSegment in interface PathgetSegment in class AbstractPathindex - the indexpublic Path.Segment[] getSegmentsArray()
PathgetSegmentsArray in interface PathgetSegmentsArray in class AbstractPathpublic List<Path.Segment> getSegmentsList()
Pathpublic String getString()
Readabledefault encoder is used to encode characters.getString in interface ReadablegetString in class AbstractPathReadable.getString(TextEncoder)public String getString(TextEncoder encoder)
ReadablegetString in interface ReadablegetString in class AbstractPathencoder - the encoder to use, or null if the default encoder should be usedReadable.getString()public String getString(NamespaceRegistry namespaceRegistry)
Readabledefault encoder is used to encode characters.getString in interface ReadablegetString in class AbstractPathnamespaceRegistry - the namespace registry that should be used to obtain the prefix for any namespace URIsReadable.getString(NamespaceRegistry,TextEncoder)public String getString(NamespaceRegistry namespaceRegistry, TextEncoder encoder)
ReadablegetString in interface ReadablegetString in class AbstractPathnamespaceRegistry - the namespace registry that should be used to obtain the prefix for the namespace URIsencoder - the encoder to use, or null if the default encoder should be usedReadable.getString(NamespaceRegistry)public String getString(NamespaceRegistry namespaceRegistry, TextEncoder encoder, TextEncoder delimiterEncoder)
ReadablegetString in interface ReadablegetString in class AbstractPathnamespaceRegistry - the namespace registry that should be used to obtain the prefix for the namespace URIs in the
segment namesencoder - the encoder to use for encoding the local part and namespace prefix of any names, or null if the
default encoder should be useddelimiterEncoder - the encoder to use for encoding the delimiter between the local part and namespace prefix of any
names, or null if the standard delimiter should be usedReadable.getString(NamespaceRegistry),
Readable.getString(NamespaceRegistry, TextEncoder)public boolean hasSameAncestor(Path that)
PathhasSameAncestor in interface PathhasSameAncestor in class AbstractPaththat - the other pathpublic boolean isAbsolute()
Pathabsolute. An absolute path
starts with a "/".public boolean isAncestorOf(Path descendant)
PathisAncestorOf in interface PathisAncestorOf in class AbstractPathdescendant - the path that may be the descendant; may be nullpublic boolean isAtOrAbove(Path other)
Pathsame as to or a ancestor of the
supplied path. This method is equivalent to (but may be more efficient than) calling isSame(other) ||
isAncestor(other), and is a convenience method that is identical to calling other.isAtOrBelow(this).isAtOrAbove in interface PathisAtOrAbove in class AbstractPathother - the other path to compare with this path; may be nullpublic boolean isAtOrBelow(Path other)
Pathsame as to or a descendant of the
supplied path. This method is equivalent to (but may be more efficient than) calling isSame(other) ||
isAncestor(other).isAtOrBelow in interface PathisAtOrBelow in class AbstractPathother - the other path to compare with this path; may be nullpublic boolean isDescendantOf(Path ancestor)
PathisDescendantOf in interface PathisDescendantOf in class AbstractPathancestor - the path that may be the ancestor; may be nullpublic boolean isNormalized()
Pathpublic boolean isRoot()
Pathpublic boolean isSameAs(Path other)
Path
this.compareTo(other) == 0 .isSameAs in interface PathisSameAs in class AbstractPathother - the other path to compare with this path; may be nullpublic Iterator<Path.Segment> iterator()
iterator in interface Iterable<Path.Segment>iterator in class AbstractPathpublic Iterator<Path> pathsFromRoot()
PathpathsFromRoot in interface PathpathsFromRoot in class AbstractPathpublic int size()
Pathpublic Path subpath(int beginIndex)
PathbeginIndex index (inclusive). This is equivalent to
calling path.subpath(beginIndex,path.size()-1).subpath in interface Pathsubpath in class AbstractPathbeginIndex - the beginning index, inclusive.public Path subpath(int beginIndex, int endIndex)
PathbeginIndex index (inclusive) and the endIndex
index (exclusive).subpath in interface Pathsubpath in class AbstractPathbeginIndex - the beginning index, inclusive.endIndex - the ending index, exclusive.public int compareTo(Path other)
compareTo in interface Comparable<Path>compareTo in class AbstractPathpublic boolean equals(Object obj)
equals in class AbstractPathpublic int hashCode()
hashCode in class AbstractPathCopyright © 2008–2016 JBoss, a division of Red Hat. All rights reserved.