Top Description Fields Constructors Methods
org.hibernate.validator.internal.engine.path

public final Class PathImpl

extends Object
implements Path, Serializable
Class Inheritance
All Implemented Interfaces
java.io.Serializable, jakarta.validation.Path, java.lang.Iterable
Static Imports
org.hibernate.validator.internal.util.logging.Messages.MESSAGES

Default implementation of jakarta.validation.Path.
Authors
Hardy Ferentschik, Gunnar Morling, Kevin Pollet <[email protected]> (C) 2011 SERLI

Field Summary

Modifier and TypeField and Description
private NodeImpl
private int
private static final int
private static final int
private static final String
LEADING_PROPERTY_GROUP

Regular expression used to split a string path into its elements.

private static final Log
private List<Path.Node>
private boolean
private static final String
private static final Pattern
private static final int
private static final String
private static final String
private static final int
private static final long

Constructor Summary

AccessConstructor and Description
private
PathImpl(PathImpl
the path to make a copy of.
path
)

Copy constructor.

private
private
PathImpl(List<Path.Node> nodeList)

Method Summary

Modifier and TypeMethod and Description
public NodeImpl
private NodeImpl
addConstructorNode(String name, Class<?>[] parameterTypes)

public NodeImpl
public NodeImpl
private NodeImpl
addMethodNode(String name, Class<?>[] parameterTypes)

public NodeImpl
addParameterNode(String nodeName, int index)

public NodeImpl
public NodeImpl
public String
private int
public static PathImpl
public static PathImpl
public static PathImpl
public static PathImpl

Returns:

a Path instance representing the path described by the given string.
createPathFromString
(String
the path as string representation.
propertyPath
)

Returns a Path instance representing the path described by the given string.

public static PathImpl
public boolean
equals(Object
the reference object with which to compare.
obj
)

Overrides java.lang.Object.equals.

Indicates whether some other object is "equal to" this one.
public NodeImpl
public int
hashCode()

Overrides java.lang.Object.hashCode.

Returns a hash code value for the object.
public boolean
private static boolean

Returns:

true if the given identifier is a valid Java Identifier
isValidJavaIdentifier
(String
string identifier to validate
identifier
)

Validate that the given identifier is a valid Java identifier according to the Java Language Specification, chapter 3.8

public Iterator<Path.Node>
iterator()

Implements java.lang.Iterable.iterator.

Returns an iterator over elements of type T.
public NodeImpl
public NodeImpl
public NodeImpl
private static PathImpl
parseProperty(String propertyName)

public void
private void
private void
public NodeImpl
setLeafNodeTypeParameter(Class<?> containerClass, Integer typeArgumentIndex)

public NodeImpl
public String
toString()

Overrides java.lang.Object.toString.

Implements jakarta.validation.Path.toString.

Returns a human-readable representation of this path.
Inherited from java.lang.Object:
clonefinalizegetClassnotifynotifyAllwaitwaitwait

Field Detail

currentLeafNodeback to summary
private NodeImpl currentLeafNode
hashCodeback to summary
private int hashCode
INDEX_GROUPback to summary
private static final int INDEX_GROUP
INDEXED_GROUPback to summary
private static final int INDEXED_GROUP
LEADING_PROPERTY_GROUPback to summary
private static final String LEADING_PROPERTY_GROUP

Regular expression used to split a string path into its elements.

See Also
Regular expression tester
LOGback to summary
private static final Log LOG
nodeListback to summary
private List<Path.Node> nodeList
nodeListRequiresCopyback to summary
private boolean nodeListRequiresCopy
OPTIONAL_INDEX_GROUPback to summary
private static final String OPTIONAL_INDEX_GROUP
PATH_PATTERNback to summary
private static final Pattern PATH_PATTERN
PROPERTY_NAME_GROUPback to summary
private static final int PROPERTY_NAME_GROUP
PROPERTY_PATH_SEPARATORback to summary
private static final String PROPERTY_PATH_SEPARATOR
REMAINING_PROPERTY_STRINGback to summary
private static final String REMAINING_PROPERTY_STRING
REMAINING_STRING_GROUPback to summary
private static final int REMAINING_STRING_GROUP
serialVersionUIDback to summary
private static final long serialVersionUID

Constructor Detail

PathImplback to summary
private PathImpl(PathImpl path)

Copy constructor.

Parameters
path:PathImpl

the path to make a copy of.

PathImplback to summary
private PathImpl()
PathImplback to summary
private PathImpl(List<Path.Node> nodeList)

Method Detail

addBeanNodeback to summary
public NodeImpl addBeanNode()
addConstructorNodeback to summary
private NodeImpl addConstructorNode(String name, Class<?>[] parameterTypes)
addContainerElementNodeback to summary
public NodeImpl addContainerElementNode(String nodeName)
addCrossParameterNodeback to summary
public NodeImpl addCrossParameterNode()
addMethodNodeback to summary
private NodeImpl addMethodNode(String name, Class<?>[] parameterTypes)
addParameterNodeback to summary
public NodeImpl addParameterNode(String nodeName, int index)
addPropertyNodeback to summary
public NodeImpl addPropertyNode(String nodeName)
addReturnValueNodeback to summary
public NodeImpl addReturnValueNode()
asStringback to summary
public String asString()
buildHashCodeback to summary
private int buildHashCode()
createCopyback to summary
public static PathImpl createCopy(PathImpl path)
createCopyWithoutLeafNodeback to summary
public static PathImpl createCopyWithoutLeafNode(PathImpl path)
createPathForExecutableback to summary
public static PathImpl createPathForExecutable(ExecutableMetaData executable)
createPathFromStringback to summary
public static PathImpl createPathFromString(String propertyPath)

Returns a Path instance representing the path described by the given string. To create a root node the empty string should be passed.

Parameters
propertyPath:String

the path as string representation.

Returns:PathImpl

a Path instance representing the path described by the given string.

Exceptions
IllegalArgumentException:
in case property == null or property cannot be parsed.
createRootPathback to summary
public static PathImpl createRootPath()
equalsback to summary
public boolean equals(Object obj)

Overrides java.lang.Object.equals.

Doc from java.lang.Object.equals.

Indicates whether some other object is "equal to" this one.

The equals method implements an equivalence relation on non-null object references:

  • It is reflexive: for any non-null reference value x, x.equals(x) should return true.
  • It is symmetric: for any non-null reference values x and y, x.equals(y) should return true if and only if y.equals(x) returns true.
  • It is transitive: for any non-null reference values x, y, and z, if x.equals(y) returns true and y.equals(z) returns true, then x.equals(z) should return true.
  • It is consistent: for any non-null reference values x and y, multiple invocations of x.equals(y) consistently return true or consistently return false, provided no information used in equals comparisons on the objects is modified.
  • For any non-null reference value x, x.equals(null) should return false.

An equivalence relation partitions the elements it operates on into equivalence classes; all the members of an equivalence class are equal to each other. Members of an equivalence class are substitutable for each other, at least for some purposes.

Parameters
obj:Object

the reference object with which to compare.

Returns:boolean

true if this object is the same as the obj argument; false otherwise.

Annotations
@Override
getLeafNodeback to summary
public NodeImpl getLeafNode()
hashCodeback to summary
public int hashCode()

Overrides java.lang.Object.hashCode.

Doc from java.lang.Object.hashCode.

Returns a hash code value for the object. This method is supported for the benefit of hash tables such as those provided by java.util.HashMap.

The general contract of hashCode is:

  • Whenever it is invoked on the same object more than once during an execution of a Java application, the hashCode method must consistently return the same integer, provided no information used in equals comparisons on the object is modified. This integer need not remain consistent from one execution of an application to another execution of the same application.
  • If two objects are equal according to the equals method, then calling the hashCode method on each of the two objects must produce the same integer result.
  • It is not required that if two objects are unequal according to the equals method, then calling the hashCode method on each of the two objects must produce distinct integer results. However, the programmer should be aware that producing distinct integer results for unequal objects may improve the performance of hash tables.
Returns:int

a hash code value for this object.

Annotations
@Override
isRootPathback to summary
public boolean isRootPath()
isValidJavaIdentifierback to summary
private static boolean isValidJavaIdentifier(String identifier)

Validate that the given identifier is a valid Java identifier according to the Java Language Specification, chapter 3.8

Parameters
identifier:String

string identifier to validate

Returns:boolean

true if the given identifier is a valid Java Identifier

Exceptions
IllegalArgumentException:
if the given identifier is null
iteratorback to summary
public Iterator<Path.Node> iterator()

Implements java.lang.Iterable.iterator.

Doc from java.lang.Iterable.iterator.

Returns an iterator over elements of type T.

Returns:Iterator<Path.Node>

an Iterator.

Annotations
@Override
makeLeafNodeIterableback to summary
public NodeImpl makeLeafNodeIterable()
makeLeafNodeIterableAndSetIndexback to summary
public NodeImpl makeLeafNodeIterableAndSetIndex(Integer index)
makeLeafNodeIterableAndSetMapKeyback to summary
public NodeImpl makeLeafNodeIterableAndSetMapKey(Object key)
parsePropertyback to summary
private static PathImpl parseProperty(String propertyName)
removeLeafNodeback to summary
public void removeLeafNode()
requiresWriteableNodeListback to summary
private void requiresWriteableNodeList()
resetHashCodeback to summary
private void resetHashCode()
setLeafNodeTypeParameterback to summary
public NodeImpl setLeafNodeTypeParameter(Class<?> containerClass, Integer typeArgumentIndex)
setLeafNodeValueIfRequiredback to summary
public NodeImpl setLeafNodeValueIfRequired(Object value)
toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Implements jakarta.validation.Path.toString.

Doc from jakarta.validation.Path.toString.

Returns a human-readable representation of this path.

Clients should not rely on any specific structure of the returned value. Instead they should iterate through the path nodes and obtain any required information by calling the methods on Node and its sub-types.

Returns:String

a human-readable representation of this path

Annotations
@Override