public final class ImmutableListPathCore extends Object implements PathCore<ImmutableListPathCore>
PathCore
implementation backed by an ImmutableList
of
segments.Modifier and Type | Class and Description |
---|---|
static class |
ImmutableListPathCore.Parser
Creates
ImmutableListPathCore instances from path strings. |
Constructor and Description |
---|
ImmutableListPathCore(String root,
Iterable<String> path)
Constructs a new core instance.
|
public static ImmutableListPathCore.Parser parser(String separator)
separator
- the path separatorpublic static ImmutableListPathCore.Parser namedRootParser(String separator, ImmutableListPathCore.Parser.NamedRootFormat format, String rootId)
Roots are parsed based on the root format and the root identifier string. For prefix roots, absolute paths start with the identifier string. The root name consists of all characters from the start of the string to the first path separator, exclusive. For postfix roots, absolute paths contain the identifier string. The root name consists of all characters from the start of the string to the identifier, inclusive. The path separator must immediately follow the identifier.
For optional prefix roots, absolute paths start with either the identifier string as described above or the path separator. Absolute paths that start with the path separator have an unnamed (empty) root.
separator
- the path separatorformat
- the root formatrootId
- the root identifierpublic boolean isAbsolute()
isAbsolute
in interface PathCore<ImmutableListPathCore>
public ImmutableListPathCore getRoot()
getRoot
in interface PathCore<ImmutableListPathCore>
public ImmutableListPathCore getFileName()
getFileName
in interface PathCore<ImmutableListPathCore>
public ImmutableListPathCore getParent()
getParent
in interface PathCore<ImmutableListPathCore>
public int getNameCount()
getNameCount
in interface PathCore<ImmutableListPathCore>
public ImmutableListPathCore getName(int index)
getName
in interface PathCore<ImmutableListPathCore>
public ImmutableListPathCore subpath(int beginIndex, int endIndex)
subpath
in interface PathCore<ImmutableListPathCore>
public boolean startsWith(ImmutableListPathCore other)
startsWith
in interface PathCore<ImmutableListPathCore>
public boolean endsWith(ImmutableListPathCore other)
endsWith
in interface PathCore<ImmutableListPathCore>
public ImmutableListPathCore normalize()
normalize
in interface PathCore<ImmutableListPathCore>
public ImmutableListPathCore resolve(ImmutableListPathCore other)
resolve
in interface PathCore<ImmutableListPathCore>
public ImmutableListPathCore resolveSibling(ImmutableListPathCore other)
resolveSibling
in interface PathCore<ImmutableListPathCore>
public ImmutableListPathCore relativize(ImmutableListPathCore other)
relativize
in interface PathCore<ImmutableListPathCore>
public String toPathString(String separator)
toPathString
in interface PathCore<ImmutableListPathCore>
public int compareTo(ImmutableListPathCore other)
compareTo
in interface Comparable<ImmutableListPathCore>
@Nullable public String getRootString()
null
if this path is
relative.public ImmutableList<String> getPathSegments()