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

public Class NodeImpl

extends Object
implements PropertyNode, MethodNode, ConstructorNode, BeanNode, ParameterNode, ReturnValueNode, CrossParameterNode, ContainerElementNode, PropertyNode, ContainerElementNode, Serializable
Class Inheritance
All Implemented Interfaces
java.io.Serializable, org.hibernate.validator.path.ContainerElementNode, jakarta.validation.Path.ContainerElementNode, jakarta.validation.Path.Node, org.hibernate.validator.path.PropertyNode, jakarta.validation.Path.PropertyNode, jakarta.validation.Path.CrossParameterNode, jakarta.validation.Path.ReturnValueNode, jakarta.validation.Path.ParameterNode, jakarta.validation.Path.BeanNode, jakarta.validation.Path.ConstructorNode, jakarta.validation.Path.MethodNode
Imports
java.io.Serializable, java.lang.invoke.MethodHandles, java.util.Arrays, .List, .Map, jakarta.validation.ElementKind, .Path, .Path.BeanNode, .Path.ConstructorNode, .Path.ContainerElementNode, .Path.CrossParameterNode, .Path.MethodNode, .Path.ParameterNode, .Path.PropertyNode, .Path.ReturnValueNode, org.hibernate.validator.internal.util.Contracts, .TypeVariables, org.hibernate.validator.internal.util.logging.Log, .LoggerFactory

Immutable implementation of a Path.Node.
Authors
Hardy Ferentschik, Gunnar Morling, Guillaume Smet

Field Summary

Modifier and TypeField and Description
private String
private final Class<?>
public static final String
private static final Class<?>[]
private int
private final Integer
private static final String
private static final String
private final boolean
public static final String
private final Object
private final ElementKind
public static final String
private static final Log
public static final String
public static final String
private final String
private final Integer
private final Class<?>[]
private final NodeImpl
public static final String
private static final long
private static final String
private static final String
private final Integer
private final Object

Constructor Summary

AccessConstructor and Description
private
NodeImpl(String name, NodeImpl parent, boolean isIterable, Integer index, Object key, ElementKind kind, Class<?>[] parameterTypes, Integer parameterIndex, Object value, Class<?> containerClass, Integer typeArgumentIndex)

Method Summary

Modifier and TypeMethod and Description
public <T extends Path.Node> T
as(Class<T>
class object representing the descriptor type to narrow down to to
nodeType
)

Implements jakarta.validation.Path.Node.as.

Narrows the type of this node down to the given type.
public final String
public final int
private String
public static NodeImpl
public static NodeImpl
createConstructorNode(String name, NodeImpl parent, Class<?>[] parameterTypes)

public static NodeImpl
public static NodeImpl
public static NodeImpl
createMethodNode(String name, NodeImpl parent, Class<?>[] parameterTypes)

public static NodeImpl
createParameterNode(String name, NodeImpl parent, int parameterIndex)

public static NodeImpl
public static NodeImpl
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 Class<?>
public final Integer
public final Object
public ElementKind
getKind()

Implements jakarta.validation.Path.Node.getKind.

The kind of element represented by the node.
public final String
getName()

Implements jakarta.validation.Path.Node.getName.

Returns the name of the element which the node represents:
  • null if it is a leaf node which represents an entity / bean. In particular, the node representing the root object.
  • The property name for a property.
  • The method name for a method.
  • The unqualified name of the type declaring the constructor for a constructor.
  • The parameter named as defined by the ParameterNameProvider for a method or constructor parameter.
  • The literal <cross-parameter> for a method or constructor cross-parameter.
  • The literal <return value> for a method or constructor return value.
  • The node name as defined by the ValueExtractor for a container element; specifically, the literal <list element> for elements stored in a list, the literal <iterable element> for elements stored in an Iterable, the literal <map key> for the keys stored in a Map and the literal <map value> for the values stored in a Map.
public int
public List<Class<?>>
public final NodeImpl
public Integer
public Object
public int
hashCode()

Overrides java.lang.Object.hashCode.

Returns a hash code value for the object.
private static boolean
includeTypeParameterInformation(Class<?> containerClass, Integer typeArgumentIndex)

public final boolean
public final boolean
public static NodeImpl
public static NodeImpl
public static NodeImpl
public static NodeImpl
public static NodeImpl
setTypeParameter(NodeImpl node, Class<?> containerClass, Integer typeArgumentIndex)

public String
toString()

Overrides java.lang.Object.toString.

Implements jakarta.validation.Path.Node.toString.

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

Field Detail

asStringback to summary
private String asString
containerClassback to summary
private final Class<?> containerClass
CROSS_PARAMETER_NODE_NAMEback to summary
public static final String CROSS_PARAMETER_NODE_NAME
EMPTY_CLASS_ARRAYback to summary
private static final Class<?>[] EMPTY_CLASS_ARRAY
hashCodeback to summary
private int hashCode
indexback to summary
private final Integer index
INDEX_CLOSEback to summary
private static final String INDEX_CLOSE
INDEX_OPENback to summary
private static final String INDEX_OPEN
isIterableback to summary
private final boolean isIterable
ITERABLE_ELEMENT_NODE_NAMEback to summary
public static final String ITERABLE_ELEMENT_NODE_NAME
keyback to summary
private final Object key
kindback to summary
private final ElementKind kind
LIST_ELEMENT_NODE_NAMEback to summary
public static final String LIST_ELEMENT_NODE_NAME
LOGback to summary
private static final Log LOG
MAP_KEY_NODE_NAMEback to summary
public static final String MAP_KEY_NODE_NAME
MAP_VALUE_NODE_NAMEback to summary
public static final String MAP_VALUE_NODE_NAME
nameback to summary
private final String name
parameterIndexback to summary
private final Integer parameterIndex
parameterTypesback to summary
private final Class<?>[] parameterTypes
parentback to summary
private final NodeImpl parent
RETURN_VALUE_NODE_NAMEback to summary
public static final String RETURN_VALUE_NODE_NAME
serialVersionUIDback to summary
private static final long serialVersionUID
TYPE_PARAMETER_CLOSEback to summary
private static final String TYPE_PARAMETER_CLOSE
TYPE_PARAMETER_OPENback to summary
private static final String TYPE_PARAMETER_OPEN
typeArgumentIndexback to summary
private final Integer typeArgumentIndex
valueback to summary
private final Object value

Constructor Detail

NodeImplback to summary
private NodeImpl(String name, NodeImpl parent, boolean isIterable, Integer index, Object key, ElementKind kind, Class<?>[] parameterTypes, Integer parameterIndex, Object value, Class<?> containerClass, Integer typeArgumentIndex)

Method Detail

asback to summary
public <T extends Path.Node> T as(Class<T> nodeType)

Implements jakarta.validation.Path.Node.as.

Doc from jakarta.validation.Path.Node.as.

Narrows the type of this node down to the given type. The appropriate type should be checked before by calling getKind().

Parameters
<T>
the type to narrow down to
nodeType:Class<T>

class object representing the descriptor type to narrow down to to

Returns:T

this node narrowed down to the given type.

Annotations
@Override
asStringback to summary
public final String asString()
buildHashCodeback to summary
public final int buildHashCode()
buildToStringback to summary
private String buildToString()
createBeanNodeback to summary
public static NodeImpl createBeanNode(NodeImpl parent)
createConstructorNodeback to summary
public static NodeImpl createConstructorNode(String name, NodeImpl parent, Class<?>[] parameterTypes)
createContainerElementNodeback to summary
public static NodeImpl createContainerElementNode(String name, NodeImpl parent)
createCrossParameterNodeback to summary
public static NodeImpl createCrossParameterNode(NodeImpl parent)
createMethodNodeback to summary
public static NodeImpl createMethodNode(String name, NodeImpl parent, Class<?>[] parameterTypes)
createParameterNodeback to summary
public static NodeImpl createParameterNode(String name, NodeImpl parent, int parameterIndex)
createPropertyNodeback to summary
public static NodeImpl createPropertyNode(String name, NodeImpl parent)
createReturnValueback to summary
public static NodeImpl createReturnValue(NodeImpl parent)
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
getContainerClassback to summary
public Class<?> getContainerClass()

Implements jakarta.validation.Path.PropertyNode.getContainerClass, jakarta.validation.Path.BeanNode.getContainerClass, jakarta.validation.Path.ContainerElementNode.getContainerClass.

Returns:Class<?>

Doc from jakarta.validation.Path.PropertyNode.getContainerClass.

the type of the container the node is placed in, if contained in a container type such as Optional, List or Map, null otherwise

Annotations
@Override
getIndexback to summary
public final Integer getIndex()

Implements jakarta.validation.Path.Node.getIndex.

Returns:Integer

Doc from jakarta.validation.Path.Node.getIndex.

the index the node is placed in if contained in an array, a List or any other container supporting indexed access, null otherwise

Annotations
@Override
getKeyback to summary
public final Object getKey()

Implements jakarta.validation.Path.Node.getKey.

Returns:Object

Doc from jakarta.validation.Path.Node.getKey.

the key the node is placed in if contained in a Map or any other container supporting keyed access, null otherwise

Annotations
@Override
getKindback to summary
public ElementKind getKind()

Implements jakarta.validation.Path.Node.getKind.

Doc from jakarta.validation.Path.Node.getKind.

The kind of element represented by the node. The following relationship between an ElementKind and its Node subtype exists:

This is useful to narrow down the Node type and access node specific information:

switch(node.getKind() {
case METHOD:
    name = node.getName();
    params = node.as(MethodNode.class).getParameterTypes();
case PARAMETER:
    index = node.as(ParameterNode.class).getParameterIndex();
[...]
}
Returns:ElementKind

the ElementKind

Annotations
@Override
getNameback to summary
public final String getName()

Implements jakarta.validation.Path.Node.getName.

Doc from jakarta.validation.Path.Node.getName.

Returns the name of the element which the node represents:

  • null if it is a leaf node which represents an entity / bean. In particular, the node representing the root object.
  • The property name for a property.
  • The method name for a method.
  • The unqualified name of the type declaring the constructor for a constructor.
  • The parameter named as defined by the ParameterNameProvider for a method or constructor parameter.
  • The literal <cross-parameter> for a method or constructor cross-parameter.
  • The literal <return value> for a method or constructor return value.
  • The node name as defined by the ValueExtractor for a container element; specifically, the literal <list element> for elements stored in a list, the literal <iterable element> for elements stored in an Iterable, the literal <map key> for the keys stored in a Map and the literal <map value> for the values stored in a Map.
Returns:String

name of the element which the node represents

Annotations
@Override
getParameterIndexback to summary
public int getParameterIndex()

Implements jakarta.validation.Path.ParameterNode.getParameterIndex.

Returns:int

Doc from jakarta.validation.Path.ParameterNode.getParameterIndex.

the parameter index in the method or constructor definition

Annotations
@Override
getParameterTypesback to summary
public List<Class<?>> getParameterTypes()

Implements jakarta.validation.Path.MethodNode.getParameterTypes, jakarta.validation.Path.ConstructorNode.getParameterTypes.

Returns:List<Class<?>>

Doc from jakarta.validation.Path.MethodNode.getParameterTypes.

the list of parameter types

Annotations
@Override
getParentback to summary
public final NodeImpl getParent()
getTypeArgumentIndexback to summary
public Integer getTypeArgumentIndex()

Implements jakarta.validation.Path.PropertyNode.getTypeArgumentIndex, jakarta.validation.Path.BeanNode.getTypeArgumentIndex, jakarta.validation.Path.ContainerElementNode.getTypeArgumentIndex.

Returns:Integer

Doc from jakarta.validation.Path.PropertyNode.getTypeArgumentIndex.

the index of the type argument affected by the violated constraint, if contained in a generic container type such as Optional, List or Map, null otherwise

Annotations
@Override
getValueback to summary
public Object getValue()

Implements org.hibernate.validator.path.PropertyNode.getValue, org.hibernate.validator.path.ContainerElementNode.getValue.

Returns:Object

Doc from org.hibernate.validator.path.PropertyNode.getValue.

Returns the value of the bean property represented by this node.

Annotations
@Override
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
includeTypeParameterInformationback to summary
private static boolean includeTypeParameterInformation(Class<?> containerClass, Integer typeArgumentIndex)
isInIterableback to summary
public final boolean isInIterable()

Implements jakarta.validation.Path.Node.isInIterable.

Returns:boolean

Doc from jakarta.validation.Path.Node.isInIterable.

true if the node represents an object contained in a multi-valued container such as Iterable or Map or an array, false otherwise

Annotations
@Override
isIterableback to summary
public final boolean isIterable()
makeIterableback to summary
public static NodeImpl makeIterable(NodeImpl node)
makeIterableAndSetIndexback to summary
public static NodeImpl makeIterableAndSetIndex(NodeImpl node, Integer index)
makeIterableAndSetMapKeyback to summary
public static NodeImpl makeIterableAndSetMapKey(NodeImpl node, Object key)
setPropertyValueback to summary
public static NodeImpl setPropertyValue(NodeImpl node, Object value)
setTypeParameterback to summary
public static NodeImpl setTypeParameter(NodeImpl node, Class<?> containerClass, Integer typeArgumentIndex)
toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Implements jakarta.validation.Path.Node.toString.

Doc from jakarta.validation.Path.Node.toString.

Returns a human-readable representation of this node.

Clients should not rely on any specific structure of the returned value. Instead they should obtain any required information by calling the methods on this interface and its sub-types.

Returns:String

a human-readable representation of this node

Annotations
@Override