Package org.apache.bval.jsr.util
Class PathImpl
- java.lang.Object
-
- org.apache.bval.jsr.util.PathImpl
-
- All Implemented Interfaces:
jakarta.validation.Path,Serializable,Iterable<jakarta.validation.Path.Node>
public class PathImpl extends Object implements jakarta.validation.Path, Serializable
Description: object holding the property path as a list of nodes. (Implementation partially based on reference implementation)
This class is not synchronized.- Version:
- $Rev: 1498347 $ $Date: 2013-07-01 12:06:18 +0200 (lun., 01 juil. 2013) $
- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classPathImpl.BuilderBuilds non-root paths from expressions.-
Nested classes/interfaces inherited from interface jakarta.validation.Path
jakarta.validation.Path.BeanNode, jakarta.validation.Path.ConstructorNode, jakarta.validation.Path.ContainerElementNode, jakarta.validation.Path.CrossParameterNode, jakarta.validation.Path.MethodNode, jakarta.validation.Path.Node, jakarta.validation.Path.ParameterNode, jakarta.validation.Path.PropertyNode, jakarta.validation.Path.ReturnValueNode
-
-
Field Summary
Fields Modifier and Type Field Description static Comparator<jakarta.validation.Path>PATH_COMPARATOR(package private) static StringPROPERTY_PATH_SEPARATOR
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description PathImpladdBean()PathImpladdNode(jakarta.validation.Path.Node node)Add a node to thisPathImpl.PathImpladdProperty(String name)Encapsulate the node manipulations needed to add a named property to this path.static PathImplcopy(jakarta.validation.Path path)Copy another Path.static PathImplcreate()Create aPathImplinstance representing the specified path.static PathImplcreatePathFromString(String propertyPath)Returns aPathinstance representing the path described by the given string.booleanequals(Object o)NodeImplgetLeafNode()Get the leaf node (if any) from thisPathImplinthashCode()booleanisRootPath()Learn whether thisPathImplpoints to the root of its graph.booleanisSubPathOf(jakarta.validation.Path path)Learn whetherpathis a parent tothis.Iterator<jakarta.validation.Path.Node>iterator()static PathImplof(jakarta.validation.Path path)NodeImplremoveLeafNode()Trim the leaf node from thisPathImpl.StringtoString()-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
-
-
-
Field Detail
-
PATH_COMPARATOR
public static final Comparator<jakarta.validation.Path> PATH_COMPARATOR
- See Also:
NodeImpl.NODE_COMPARATOR
-
PROPERTY_PATH_SEPARATOR
static final String PROPERTY_PATH_SEPARATOR
- See Also:
- Constant Field Values
-
-
Method Detail
-
createPathFromString
public static PathImpl createPathFromString(String propertyPath)
Returns aPathinstance representing the path described by the given string. To create a root node the empty string should be passed. Note: This signature is to maintain pluggability with the RI impl.- Parameters:
propertyPath- the path as string representation.- Returns:
- a
Pathinstance representing the path described by the given string.
-
create
public static PathImpl create()
Create aPathImplinstance representing the specified path.- Returns:
- PathImpl
-
copy
public static PathImpl copy(jakarta.validation.Path path)
Copy another Path.- Parameters:
path-- Returns:
- new
PathImpl
-
of
public static PathImpl of(jakarta.validation.Path path)
-
isRootPath
public boolean isRootPath()
Learn whether thisPathImplpoints to the root of its graph.- Returns:
- true if no child nodes
-
addNode
public PathImpl addNode(jakarta.validation.Path.Node node)
Add a node to thisPathImpl.- Parameters:
node- to add- Returns:
this, fluently
-
addProperty
public PathImpl addProperty(String name)
Encapsulate the node manipulations needed to add a named property to this path.- Parameters:
name-- Returns:
this, fluently
-
addBean
public PathImpl addBean()
-
removeLeafNode
public NodeImpl removeLeafNode()
Trim the leaf node from thisPathImpl.- Returns:
- the node removed
- Throws:
IllegalStateException- if no nodes are found
-
getLeafNode
public NodeImpl getLeafNode()
Get the leaf node (if any) from thisPathImpl- Returns:
NodeImpl
-
iterator
public Iterator<jakarta.validation.Path.Node> iterator()
-
isSubPathOf
public boolean isSubPathOf(jakarta.validation.Path path)
Learn whetherpathis a parent tothis.- Parameters:
path-- Returns:
trueif our nodes begin with nodes equal to those found inpath
-
toString
public String toString()
-
-