public class AstIdentifier extends AstNode implements IdentifierNode
Constructor and Description |
---|
AstIdentifier(String name,
int index) |
Modifier and Type | Method and Description |
---|---|
void |
appendStructure(StringBuilder b,
Bindings bindings) |
Object |
eval(Bindings bindings,
ELContext context) |
int |
getCardinality()
Get the node's number of children.
|
AstNode |
getChild(int i)
Get i'th child
|
int |
getIndex()
Get the unique index of this identifier in the expression (e.g.
|
protected Method |
getMethod(Bindings bindings,
ELContext context,
Class<?> returnType,
Class<?>[] paramTypes) |
MethodInfo |
getMethodInfo(Bindings bindings,
ELContext context,
Class<?> returnType,
Class<?>[] paramTypes)
Get method information.
|
String |
getName()
Get the identifier name
|
Class<?> |
getType(Bindings bindings,
ELContext context)
Get the value type accepted in
ExpressionNode.setValue(Bindings, ELContext, Object) . |
ValueReference |
getValueReference(Bindings bindings,
ELContext context)
Get value reference.
|
Object |
invoke(Bindings bindings,
ELContext context,
Class<?> returnType,
Class<?>[] paramTypes,
Object[] params)
Invoke method.
|
boolean |
isLeftValue() |
boolean |
isLiteralText() |
boolean |
isMethodInvocation() |
boolean |
isReadOnly(Bindings bindings,
ELContext context)
Determine whether
ExpressionNode.setValue(Bindings, ELContext, Object) will throw a
PropertyNotWritableException . |
void |
setValue(Bindings bindings,
ELContext context,
Object value)
Assign value.
|
String |
toString() |
getStructuralId, getValue
public AstIdentifier(String name, int index)
public Class<?> getType(Bindings bindings, ELContext context)
ExpressionNode
ExpressionNode.setValue(Bindings, ELContext, Object)
.getType
in interface ExpressionNode
bindings
- bindings containing variables and functionscontext
- evaluation contextnull
for non-lvalue nodespublic boolean isLeftValue()
isLeftValue
in interface ExpressionNode
true
if the subtree rooted at this node could be used as an lvalue
expression (identifier or property sequence with non-literal prefix).public boolean isMethodInvocation()
isMethodInvocation
in interface ExpressionNode
true
if the subtree rooted at this node is a method invocation.public boolean isLiteralText()
isLiteralText
in interface ExpressionNode
true
if this node represents literal textpublic ValueReference getValueReference(Bindings bindings, ELContext context)
ExpressionNode
getValueReference
in interface ExpressionNode
public void setValue(Bindings bindings, ELContext context, Object value)
ExpressionNode
setValue
in interface ExpressionNode
bindings
- bindings containing variables and functionscontext
- evaluation contextvalue
- value to setpublic boolean isReadOnly(Bindings bindings, ELContext context)
ExpressionNode
ExpressionNode.setValue(Bindings, ELContext, Object)
will throw a
PropertyNotWritableException
.isReadOnly
in interface ExpressionNode
bindings
- bindings containing variables and functionscontext
- evaluation contexttrue
if this a read-only expression nodeprotected Method getMethod(Bindings bindings, ELContext context, Class<?> returnType, Class<?>[] paramTypes)
public MethodInfo getMethodInfo(Bindings bindings, ELContext context, Class<?> returnType, Class<?>[] paramTypes)
ExpressionNode
null
.getMethodInfo
in interface ExpressionNode
bindings
- bindings containing variables and functionscontext
- evaluation contextreturnType
- expected method return type (may be null
meaning don't care)paramTypes
- expected method argument typesnull
public Object invoke(Bindings bindings, ELContext context, Class<?> returnType, Class<?>[] paramTypes, Object[] params)
ExpressionNode
invoke
in interface ExpressionNode
bindings
- bindings containing variables and functionscontext
- evaluation contextreturnType
- expected method return type (may be null
meaning don't care)paramTypes
- expected method argument typesparams
- parameter valuespublic void appendStructure(StringBuilder b, Bindings bindings)
appendStructure
in class AstNode
public int getIndex()
IdentifierNode
getIndex
in interface IdentifierNode
public String getName()
IdentifierNode
getName
in interface IdentifierNode
public int getCardinality()
Node
getCardinality
in interface Node
Copyright © 2019. All rights reserved.