public class ZPathImpl extends Object implements ZPath
Modifier and Type | Method and Description |
---|---|
ZPath |
child(Object child)
Return a ZPath that represents a child ZNode of this ZPath.
|
boolean |
equals(Object o) |
static ZPath |
from(List<String> names)
Convert individual path names into a ZPath.
|
static ZPath |
from(String[] names)
Convert individual path names into a ZPath.
|
static ZPath |
from(ZPath base,
List<String> names)
Convert individual path names into a ZPath starting at the given base.
|
static ZPath |
from(ZPath base,
String[] names)
Convert individual path names into a ZPath starting at the given base.
|
String |
fullPath()
The string full path that this ZPath represents
|
int |
hashCode() |
boolean |
isResolved()
Return true if this path is fully resolved (i.e.
|
boolean |
isRoot()
Return true/false if this is the root ZPath
|
String |
nodeName()
The node name at this ZPath
|
ZPath |
parent()
Return this ZPath's parent
|
static ZPath |
parse(String fullPath,
UnaryOperator<String> nameFilter)
Take a ZNode string path and return a ZPath
|
ZPath |
resolved(List<Object> parameters)
When creating paths, any node in the path can be set to
ZPath.parameter() . |
boolean |
startsWith(ZPath path)
Return true if this path starts with the given path.
|
Pattern |
toSchemaPathPattern()
Return a regex Pattern useful for using in
Schema |
String |
toString() |
public static final ZPath root
public static ZPath parse(String fullPath, UnaryOperator<String> nameFilter)
ZPath
public static ZPath from(String[] names)
ZPath
ZPath.from("my", "full", "path")
. Any/all of the names can be passed as
ZPath.parameter()
so that the path can be resolved later using
of the resolved()
methods.public static ZPath from(List<String> names)
ZPath
ZPath.parameter()
so that the path can be resolved later using
of the resolved()
methods.public static ZPath from(ZPath base, String[] names)
ZPath
ZPath.from(base, "my", "full", "path")
would be "/home/base/my/full/path". Any/all of the names can be passed as
ZPath.parameter()
so that the path can be resolved later using
of the resolved()
methods.public static ZPath from(ZPath base, List<String> names)
ZPath
ZPath.parameter()
so that the path can be resolved later using
of the resolved()
methods.public ZPath child(Object child)
ZPath
Return a ZPath that represents a child ZNode of this ZPath. e.g.
ZPath.from("a", "b").at("c")
represents the path "/a/b/c"
The replacement is the toString()
value of child or,
if it implements NodeName
,
the value of nodeName()
.
public boolean isRoot()
ZPath
public boolean startsWith(ZPath path)
ZPath
ZPath.from("/one/two/three").startsWith(ZPath.from("/one/two"))
returns truestartsWith
in interface ZPath
path
- base pathpublic Pattern toSchemaPathPattern()
ZPath
Schema
toSchemaPathPattern
in interface ZPath
public String fullPath()
ZPath
public String nodeName()
ZPath
public ZPath resolved(List<Object> parameters)
ZPath
When creating paths, any node in the path can be set to ZPath.parameter()
.
At runtime, the ZPath can be "resolved" by replacing these nodes with values.
The replacement is the toString()
value of the parameter object or,
if the object implements NodeName
,
the value of nodeName()
.
resolved
in interface Resolvable
resolved
in interface ZPath
parameters
- list of replacements. Must have be the same length as the number of
parameter nodes in the pathpublic boolean isResolved()
ZPath
Note: ZPath's returned by the parse()
method are always considered fully resolved, despite if there are
remaining elements in the path which appear to be parameters (but are not, i.e. {one}
).
When working with parameters, use the parseWithIds()
method, which returns a ZPath with a
resolved state based on the presence of unresolved parameter elements in the ZPath.
isResolved
in interface ZPath
Copyright © 2011–2023 The Apache Software Foundation. All rights reserved.