@Immutable public interface Path extends Iterable<String>
Document.| Modifier and Type | Interface and Description |
|---|---|
static interface |
Path.Segments |
| Modifier and Type | Method and Description |
|---|---|
Path |
append(Path relPath)
Create a new path consisting of this path appended with the given path that will be treated as a relative path.
|
default Path |
append(String relPath)
Create a new path consisting of this path with one or more additional segments given by the relative path.
|
default void |
fromRoot(Consumer<Path> consumer)
Call the consumer with the path of every ancestor (except root) down to this path.
|
default boolean |
isMultiple()
Return whether this path has more than one segment.
|
default boolean |
isRoot()
Return whether this path is the root path with no segments.
|
default boolean |
isSingle()
Return whether this path has a single segment.
|
Optional<String> |
lastSegment()
Get the last segment, if there is one.
|
static Optional<Path> |
optionalRoot()
Get an
Optional reference to the root path. |
Optional<Path> |
parent()
Get the optional parent path.
|
static Path |
parse(String path)
Parse a JSON Path expression.
|
static Path |
parse(String path,
boolean resolveJsonPointerEscapes)
Parse a JSON Path expression.
|
static Path |
root()
Get the zero-length path.
|
String |
segment(int index)
Get the segment at the given index.
|
int |
size()
Get the number of segments in the path.
|
Path |
subpath(int length)
Get a portion of this path that has a specified number of segments.
|
String |
toRelativePath()
Obtain the representation of this path as a relative path without the leading '/'.
|
forEach, iterator, spliteratorstatic Path root()
static Optional<Path> optionalRoot()
Optional reference to the root path. The resulting Optional will always be
present.static Path parse(String path)
/'); any '~' or '/
' literals must be escaped. Trailing slashes are ignored.path - the path as a string; may not be null, but may be an empty string or "/" for a root pathstatic Path parse(String path, boolean resolveJsonPointerEscapes)
/'); any '~' or '/
' literals must be escaped. Trailing slashes are ignored.path - the path as a string; may not be null, but may be an empty string or "/" for a root pathresolveJsonPointerEscapes - true if '~' and '/ ' literals are to be escaped as '~0'
and '~1', respectively, or false if they are not to be escapeddefault boolean isRoot()
size() == 0.default boolean isSingle()
size() == 1.default boolean isMultiple()
size() > 1.int size()
Optional<Path> parent()
Optional<String> lastSegment()
Path subpath(int length)
length - the number of segmentsthis.size()String segment(int index)
index - the index of the segmentIllegalArgumentException - if the index value is equal to or greater than #size()default Path append(String relPath)
relPath - the relative path to be appended to this path; may not be nullPath append(Path relPath)
relPath - the relative path to be appended to this path; may not be nullString toRelativePath()
Copyright © 2020 JBoss by Red Hat. All rights reserved.