Class ZPathImpl
- java.lang.Object
-
- org.apache.curator.x.async.modeled.details.ZPathImpl
-
- All Implemented Interfaces:
Resolvable,ZPath
public class ZPathImpl extends java.lang.Object implements ZPath
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description ZPathchild(java.lang.Object child)Return a ZPath that represents a child ZNode of this ZPath.booleanequals(java.lang.Object o)static ZPathfrom(java.lang.String[] names)Convert individual path names into a ZPath.static ZPathfrom(java.util.List<java.lang.String> names)Convert individual path names into a ZPath.static ZPathfrom(ZPath base, java.lang.String[] names)Convert individual path names into a ZPath starting at the given base.static ZPathfrom(ZPath base, java.util.List<java.lang.String> names)Convert individual path names into a ZPath starting at the given base.java.lang.StringfullPath()The string full path that this ZPath representsinthashCode()booleanisResolved()Return true if this path is fully resolved (i.e.booleanisRoot()Return true/false if this is the root ZPathjava.lang.StringnodeName()The node name at this ZPathZPathparent()Return this ZPath's parentstatic ZPathparse(java.lang.String fullPath, java.util.function.UnaryOperator<java.lang.String> nameFilter)Take a ZNode string path and return a ZPathZPathresolved(java.util.List<java.lang.Object> parameters)When creating paths, any node in the path can be set toZPath.parameter().booleanstartsWith(ZPath path)Return true if this path starts with the given path.java.util.regex.PatterntoSchemaPathPattern()Return a regex Pattern useful for using inSchemajava.lang.StringtoString()
-
-
-
Field Detail
-
root
public static final ZPath root
-
-
Method Detail
-
parse
public static ZPath parse(java.lang.String fullPath, java.util.function.UnaryOperator<java.lang.String> nameFilter)
Description copied from interface:ZPathTake a ZNode string path and return a ZPath- Parameters:
fullPath- the path to parsenameFilter- each part of the path is passed through this filter- Returns:
- ZPath
-
from
public static ZPath from(java.lang.String[] names)
Description copied from interface:ZPathConvert individual path names into a ZPath. E.g.ZPath.from("my", "full", "path"). Any/all of the names can be passed asZPath.parameter()so that the path can be resolved later using of theresolved()methods.- Parameters:
names- path names- Returns:
- ZPath
-
from
public static ZPath from(java.util.List<java.lang.String> names)
Description copied from interface:ZPathConvert individual path names into a ZPath. Any/all of the names can be passed asZPath.parameter()so that the path can be resolved later using of theresolved()methods.- Parameters:
names- path names- Returns:
- ZPath
-
from
public static ZPath from(ZPath base, java.lang.String[] names)
Description copied from interface:ZPathConvert individual path names into a ZPath starting at the given base. E.g. if base is "/home/base"ZPath.from(base, "my", "full", "path")would be "/home/base/my/full/path". Any/all of the names can be passed asZPath.parameter()so that the path can be resolved later using of theresolved()methods.- Parameters:
base- base/starting pathnames- path names- Returns:
- ZPath
-
from
public static ZPath from(ZPath base, java.util.List<java.lang.String> names)
Description copied from interface:ZPathConvert individual path names into a ZPath starting at the given base. Any/all of the names can be passed asZPath.parameter()so that the path can be resolved later using of theresolved()methods.- Parameters:
base- base/starting pathnames- path names- Returns:
- ZPath
-
child
public ZPath child(java.lang.Object child)
Description copied from interface:ZPathReturn 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 implementsNodeName, the value ofnodeName().
-
isRoot
public boolean isRoot()
Description copied from interface:ZPathReturn true/false if this is the root ZPath
-
startsWith
public boolean startsWith(ZPath path)
Description copied from interface:ZPathReturn true if this path starts with the given path. i.e.ZPath.from("/one/two/three").startsWith(ZPath.from("/one/two"))returns true- Specified by:
startsWithin interfaceZPath- Parameters:
path- base path- Returns:
- true/false
-
toSchemaPathPattern
public java.util.regex.Pattern toSchemaPathPattern()
Description copied from interface:ZPathReturn a regex Pattern useful for using inSchema- Specified by:
toSchemaPathPatternin interfaceZPath- Returns:
- pattern for this path
-
fullPath
public java.lang.String fullPath()
Description copied from interface:ZPathThe string full path that this ZPath represents
-
nodeName
public java.lang.String nodeName()
Description copied from interface:ZPathThe node name at this ZPath
-
equals
public boolean equals(java.lang.Object o)
- Overrides:
equalsin classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
resolved
public ZPath resolved(java.util.List<java.lang.Object> parameters)
Description copied from interface:ZPathWhen 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 implementsNodeName, the value ofnodeName().- Specified by:
resolvedin interfaceResolvable- Specified by:
resolvedin interfaceZPath- Parameters:
parameters- list of replacements. Must have be the same length as the number of parameter nodes in the path- Returns:
- new resolved ZPath
-
isResolved
public boolean isResolved()
Description copied from interface:ZPathReturn true if this path is fully resolved (i.e. has no unresoled parameters)- Specified by:
isResolvedin interfaceZPath- Returns:
- true/false
-
-