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 class
PathImpl.Builder
Builds 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 String
PROPERTY_PATH_SEPARATOR
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description PathImpl
addBean()
PathImpl
addNode(jakarta.validation.Path.Node node)
Add a node to thisPathImpl
.PathImpl
addProperty(String name)
Encapsulate the node manipulations needed to add a named property to this path.static PathImpl
copy(jakarta.validation.Path path)
Copy another Path.static PathImpl
create()
Create aPathImpl
instance representing the specified path.static PathImpl
createPathFromString(String propertyPath)
Returns aPath
instance representing the path described by the given string.boolean
equals(Object o)
NodeImpl
getLeafNode()
Get the leaf node (if any) from thisPathImpl
int
hashCode()
boolean
isRootPath()
Learn whether thisPathImpl
points to the root of its graph.boolean
isSubPathOf(jakarta.validation.Path path)
Learn whetherpath
is a parent tothis
.Iterator<jakarta.validation.Path.Node>
iterator()
static PathImpl
of(jakarta.validation.Path path)
NodeImpl
removeLeafNode()
Trim the leaf node from thisPathImpl
.String
toString()
-
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 aPath
instance 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
Path
instance representing the path described by the given string.
-
create
public static PathImpl create()
Create aPathImpl
instance 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 thisPathImpl
points 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 whetherpath
is a parent tothis
.- Parameters:
path
-- Returns:
true
if our nodes begin with nodes equal to those found inpath
-
toString
public String toString()
-
-