public class NodeImpl extends Object implements Path.PropertyNode, Path.MethodNode, Path.ConstructorNode, Path.BeanNode, Path.ParameterNode, Path.ReturnValueNode, Path.CrossParameterNode, PropertyNode, Serializable
Path.Node.| 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 |
createCollectionElementNode(NodeImpl parent) |
static NodeImpl |
createConstructorNode(String name,
NodeImpl parent,
Class<?>[] parameterTypes) |
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) |
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() |
Object |
getValue() |
int |
hashCode() |
boolean |
isInIterable() |
boolean |
isIterable() |
static NodeImpl |
makeIterable(NodeImpl node) |
static NodeImpl |
setIndex(NodeImpl node,
Integer index) |
static NodeImpl |
setMapKey(NodeImpl node,
Object key) |
static NodeImpl |
setPropertyValue(NodeImpl node,
Object value) |
String |
toString()
Returns a human-readable representation of this node.
|
clone, finalize, getClass, notify, notifyAll, wait, wait, waitgetContainerClass, getTypeArgumentIndexgetContainerClass, getTypeArgumentIndexpublic 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 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 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 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 © 2018 JBoss by Red Hat. All rights reserved.