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() |
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 final String getName()
Path.Node
null
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.public final boolean isInIterable()
isInIterable
in interface Path.Node
true
if the node represents an object contained in an
Iterable
or in a Map
, false
otherwisepublic final boolean isIterable()
public final Integer getIndex()
public final Object getKey()
public final NodeImpl getParent()
public ElementKind getKind()
Path.Node
ElementKind
and its Node
subtype exists:
ElementKind.BEAN
: Path.BeanNode
ElementKind.PROPERTY
: Path.PropertyNode
ElementKind.METHOD
: Path.MethodNode
ElementKind.CONSTRUCTOR
: Path.ConstructorNode
ElementKind.PARAMETER
: Path.ParameterNode
ElementKind.CROSS_PARAMETER
: Path.CrossParameterNode
ElementKind.RETURN_VALUE
: Path.ReturnValueNode
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.Node
Path.Node.getKind()
.public List<Class<?>> getParameterTypes()
getParameterTypes
in interface Path.ConstructorNode
getParameterTypes
in interface Path.MethodNode
public int getParameterIndex()
getParameterIndex
in interface Path.ParameterNode
public Object getValue()
getValue
in interface PropertyNode
public final String asString()
public final int buildHashCode()
Copyright © 2017 JBoss by Red Hat. All rights reserved.