Top Description Inners Methods
jakarta.validation

public Interface Path

extends Iterable<Path.Node>
Imports
java.util.List, jakarta.validation.valueextraction.ValueExtractor

Represents the navigation path from an object to another in an object graph. Each path element is represented by a Node.

The path corresponds to the succession of nodes in the order they are returned by the Iterator.

Authors
Emmanuel Bernard, Gunnar Morling, Guillaume Smet

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static interface
Path.BeanNode

Node representing a bean.

public static interface
Path.ConstructorNode

Node representing a constructor.

public static interface
Path.ContainerElementNode

Node representing an element in a generic container such as Optional, List or Map.

public static interface
Path.CrossParameterNode

Node representing the element holding cross-parameter constraints of a method or constructor.

public static interface
Path.MethodNode

Node representing a method.

public static interface
Path.Node

Represents an element of a navigation path.

public static interface
Path.ParameterNode

Node representing a parameter of a method or constructor.

public static interface
Path.PropertyNode

Node representing a property.

public static interface
Path.ReturnValueNode

Node representing the return value of a method or constructor.

Method Summary

Modifier and TypeMethod and Description
public String

Returns:

a human-readable representation of this path
toString
()

Returns a human-readable representation of this path.

Inherited from java.lang.Iterable:
forEachiteratorspliterator

Method Detail

toStringback to summary
public String 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
Since
2.0
jakarta.validation back to summary

public Interface Path.BeanNode

extends Node

Node representing a bean.
Since
1.1

Method Summary

Modifier and TypeMethod and Description
public Class<?>

Returns:

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

public Integer

Returns:

the index of the type argument affected by the violated constraint, if contained in a generic container type such as Optional, List or Map.
getTypeArgumentIndex
()

Inherited from jakarta.validation.Path.Node:
asgetIndexgetKeygetKindgetNameisInIterabletoString

Method Detail

getContainerClassback to summary
public Class<?> getContainerClass()
Returns:Class<?>

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

Since
2.0
getTypeArgumentIndexback to summary
public Integer getTypeArgumentIndex()
Returns:Integer

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

Since
2.0
jakarta.validation back to summary

public Interface Path.ConstructorNode

extends Node

Node representing a constructor.
Since
1.1

Method Summary

Modifier and TypeMethod and Description
public List<Class<?>>

Returns:

the list of parameter types
getParameterTypes
()

Inherited from jakarta.validation.Path.Node:
asgetIndexgetKeygetKindgetNameisInIterabletoString

Method Detail

getParameterTypesback to summary
public List<Class<?>> getParameterTypes()
Returns:List<Class<?>>

the list of parameter types

jakarta.validation back to summary

public Interface Path.ContainerElementNode

extends Node

Node representing an element in a generic container such as Optional, List or Map.
Since
2.0

Method Summary

Modifier and TypeMethod and Description
public Class<?>

Returns:

the type of the container the node is placed in
getContainerClass
()

public Integer

Returns:

the index of the type argument affected by the violated constraint
getTypeArgumentIndex
()

Inherited from jakarta.validation.Path.Node:
asgetIndexgetKeygetKindgetNameisInIterabletoString

Method Detail

getContainerClassback to summary
public Class<?> getContainerClass()
Returns:Class<?>

the type of the container the node is placed in

getTypeArgumentIndexback to summary
public Integer getTypeArgumentIndex()
Returns:Integer

the index of the type argument affected by the violated constraint

jakarta.validation back to summary

public Interface Path.CrossParameterNode

extends Node

Node representing the element holding cross-parameter constraints of a method or constructor.
Since
1.1

Method Summary

Inherited from jakarta.validation.Path.Node:
asgetIndexgetKeygetKindgetNameisInIterabletoString
jakarta.validation back to summary

public Interface Path.MethodNode

extends Node

Node representing a method.
Since
1.1

Method Summary

Modifier and TypeMethod and Description
public List<Class<?>>

Returns:

the list of parameter types
getParameterTypes
()

Inherited from jakarta.validation.Path.Node:
asgetIndexgetKeygetKindgetNameisInIterabletoString

Method Detail

getParameterTypesback to summary
public List<Class<?>> getParameterTypes()
Returns:List<Class<?>>

the list of parameter types

jakarta.validation back to summary

public Interface Path.Node

Known Direct Subinterfaces
jakarta.validation.Path.MethodNode, jakarta.validation.Path.ConstructorNode, jakarta.validation.Path.ReturnValueNode, jakarta.validation.Path.ParameterNode, jakarta.validation.Path.CrossParameterNode, jakarta.validation.Path.BeanNode, jakarta.validation.Path.PropertyNode, jakarta.validation.Path.ContainerElementNode

Represents an element of a navigation path.

Method Summary

Modifier and TypeMethod and Description
public <
the type to narrow down to
T extends Path.Node
>
T

Returns:

this node narrowed down to the given type.
as
(Class<T>
class object representing the descriptor type to narrow down to to
nodeType
)

Narrows the type of this node down to the given type.

public Integer

Returns:

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

public Object

Returns:

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

public ElementKind

Returns:

the ElementKind
getKind
()

The kind of element represented by the node.

public String

Returns:

name of the element which the node represents
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 boolean

Returns:

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

public String

Returns:

a human-readable representation of this node
toString
()

Returns a human-readable representation of this node.

Method Detail

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

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.

Exceptions
ClassCastException:
if this node is not assignable to the type T
Since
1.1
getIndexback to summary
public Integer getIndex()
Returns:Integer

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

getKeyback to summary
public Object getKey()
Returns:Object

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

getKindback to summary
public ElementKind 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

Since
1.1
getNameback to summary
public String 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

isInIterableback to summary
public boolean isInIterable()
Returns:boolean

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

toStringback to summary
public String 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
Since
2.0
jakarta.validation back to summary

public Interface Path.ParameterNode

extends Node

Node representing a parameter of a method or constructor.
Since
1.1

Method Summary

Modifier and TypeMethod and Description
public int

Returns:

the parameter index in the method or constructor definition
getParameterIndex
()

Inherited from jakarta.validation.Path.Node:
asgetIndexgetKeygetKindgetNameisInIterabletoString

Method Detail

getParameterIndexback to summary
public int getParameterIndex()
Returns:int

the parameter index in the method or constructor definition

jakarta.validation back to summary

public Interface Path.PropertyNode

extends Node

Node representing a property.
Since
1.1

Method Summary

Modifier and TypeMethod and Description
public Class<?>

Returns:

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

public Integer

Returns:

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
getTypeArgumentIndex
()

Inherited from jakarta.validation.Path.Node:
asgetIndexgetKeygetKindgetNameisInIterabletoString

Method Detail

getContainerClassback to summary
public Class<?> getContainerClass()
Returns:Class<?>

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

Since
2.0
getTypeArgumentIndexback to summary
public Integer getTypeArgumentIndex()
Returns:Integer

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

Since
2.0
jakarta.validation back to summary

public Interface Path.ReturnValueNode

extends Node

Node representing the return value of a method or constructor.
Since
1.1

Method Summary

Inherited from jakarta.validation.Path.Node:
asgetIndexgetKeygetKindgetNameisInIterabletoString