public class NodeImpl extends Object implements Path.PropertyNode, Path.MethodNode, Path.ConstructorNode, Path.BeanNode, Path.ParameterNode, Path.ReturnValueNode, Path.CrossParameterNode, Path.ContainerElementNode, PropertyNode, ContainerElementNode, Serializable
Path.Node.| Modifier and Type | Field and Description |
|---|---|
static String |
CROSS_PARAMETER_NODE_NAME |
static String |
ITERABLE_ELEMENT_NODE_NAME |
static String |
LIST_ELEMENT_NODE_NAME |
static String |
MAP_KEY_NODE_NAME |
static String |
MAP_VALUE_NODE_NAME |
static String |
RETURN_VALUE_NODE_NAME |
| Modifier and Type | Method and Description |
|---|---|
<T extends Path.Node> |
as(Class<T> nodeType)
Narrows the type of this node down to the given type.
|
String |
asString() |
int |
buildHashCode() |
static NodeImpl |
createBeanNode(NodeImpl parent) |
static NodeImpl |
createConstructorNode(String name,
NodeImpl parent,
Class<?>[] parameterTypes) |
static NodeImpl |
createContainerElementNode(String name,
NodeImpl parent) |
static NodeImpl |
createCrossParameterNode(NodeImpl parent) |
static NodeImpl |
createMethodNode(String name,
NodeImpl parent,
Class<?>[] parameterTypes) |
static NodeImpl |
createParameterNode(String name,
NodeImpl parent,
int parameterIndex) |
static NodeImpl |
createPropertyNode(String name,
NodeImpl parent) |
static NodeImpl |
createReturnValue(NodeImpl parent) |
boolean |
equals(Object obj) |
Class<?> |
getContainerClass() |
Integer |
getIndex() |
Object |
getKey() |
ElementKind |
getKind()
The kind of element represented by the node.
|
String |
getName()
Returns the name of the element which the node represents:
null if it is a leaf node which represents an entity / bean. |
int |
getParameterIndex() |
List<Class<?>> |
getParameterTypes() |
NodeImpl |
getParent() |
Integer |
getTypeArgumentIndex() |
Object |
getValue() |
int |
hashCode() |
boolean |
isInIterable() |
boolean |
isIterable() |
static NodeImpl |
makeIterable(NodeImpl node) |
static NodeImpl |
makeIterableAndSetIndex(NodeImpl node,
Integer index) |
static NodeImpl |
makeIterableAndSetMapKey(NodeImpl node,
Object key) |
static NodeImpl |
setPropertyValue(NodeImpl node,
Object value) |
static NodeImpl |
setTypeParameter(NodeImpl node,
Class<?> containerClass,
Integer typeArgumentIndex) |
String |
toString()
Returns a human-readable representation of this node.
|
public static final String RETURN_VALUE_NODE_NAME
public static final String CROSS_PARAMETER_NODE_NAME
public static final String ITERABLE_ELEMENT_NODE_NAME
public static final String LIST_ELEMENT_NODE_NAME
public static final String MAP_KEY_NODE_NAME
public static final String MAP_VALUE_NODE_NAME
public static NodeImpl createContainerElementNode(String name, NodeImpl parent)
public static NodeImpl createParameterNode(String name, NodeImpl parent, int parameterIndex)
public static NodeImpl createMethodNode(String name, NodeImpl parent, Class<?>[] parameterTypes)
public static NodeImpl createConstructorNode(String name, NodeImpl parent, Class<?>[] parameterTypes)
public static NodeImpl makeIterableAndSetIndex(NodeImpl node, Integer index)
public static NodeImpl setTypeParameter(NodeImpl node, Class<?> containerClass, Integer typeArgumentIndex)
public final String getName()
Path.Nodenull if it is a leaf node which represents an entity / bean.
In particular, the node representing the root object.ParameterNameProvider
for a method or constructor parameter.<cross-parameter> for a method or constructor
cross-parameter.<return value> for a method or constructor return
value.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 final boolean isInIterable()
isInIterable in interface Path.Nodetrue if the node represents an object contained in
a multi-valued container such as Iterable or Map or an array,
false otherwisepublic final boolean isIterable()
public final Integer getIndex()
public final Object getKey()
public Class<?> getContainerClass()
getContainerClass in interface Path.BeanNodegetContainerClass in interface Path.ContainerElementNodegetContainerClass in interface Path.PropertyNodeOptional, List or Map,
null otherwisepublic Integer getTypeArgumentIndex()
getTypeArgumentIndex in interface Path.BeanNodegetTypeArgumentIndex in interface Path.ContainerElementNodegetTypeArgumentIndex in interface Path.PropertyNodeOptional, List or
Map, null otherwisepublic final NodeImpl getParent()
public ElementKind getKind()
Path.NodeElementKind and its Node subtype exists:
ElementKind.BEAN: Path.BeanNodeElementKind.PROPERTY: Path.PropertyNodeElementKind.METHOD: Path.MethodNodeElementKind.CONSTRUCTOR: Path.ConstructorNodeElementKind.PARAMETER: Path.ParameterNodeElementKind.CROSS_PARAMETER: Path.CrossParameterNodeElementKind.RETURN_VALUE: Path.ReturnValueNodeElementKind.CONTAINER_ELEMENT: Path.ContainerElementNode
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();
[...]
}
public <T extends Path.Node> T as(Class<T> nodeType)
Path.NodePath.Node.getKind().public List<Class<?>> getParameterTypes()
getParameterTypes in interface Path.ConstructorNodegetParameterTypes in interface Path.MethodNodepublic int getParameterIndex()
getParameterIndex in interface Path.ParameterNodepublic Object getValue()
getValue in interface ContainerElementNodegetValue in interface PropertyNodepublic String toString()
Path.NodeClients 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.
public final String asString()
public final int buildHashCode()
Copyright © 2019 JBoss by Red Hat. All rights reserved.