public final class TreeMethodExpression extends MethodExpression
invoke(ELContext, Object[])
or getMethodInfo(ELContext)
).
Instances of this class are usually created using an ExpressionFactoryImpl
.Constructor and Description |
---|
TreeMethodExpression(TreeStore store,
FunctionMapper functions,
VariableMapper variables,
TypeConverter converter,
String expr,
Class<?> returnType,
Class<?>[] paramTypes)
Create a new method expression.
|
Modifier and Type | Method and Description |
---|---|
void |
dump(PrintWriter writer)
Print the parse tree.
|
boolean |
equals(Object obj)
Expressions are compared using the concept of a structural id:
variable and function names are anonymized such that two expressions with
same tree structure will also have the same structural id and vice versa.
|
String |
getExpressionString()
Returns the original String used to create this Expression, unmodified.
|
MethodInfo |
getMethodInfo(ELContext context)
Evaluates the expression and answers information about the method
|
int |
hashCode()
Returns the hash code for this Expression.
|
Object |
invoke(ELContext context,
Object[] paramValues)
Evaluates the expression and invokes the method.
|
boolean |
isDeferred()
Answer
true if this is a deferred expression (starting with #{ ) |
boolean |
isLiteralText()
Returns whether this expression was created from only literal text.
|
boolean |
isParmetersProvided()
Return whether this MethodExpression was created with parameters.
|
String |
toString() |
public TreeMethodExpression(TreeStore store, FunctionMapper functions, VariableMapper variables, TypeConverter converter, String expr, Class<?> returnType, Class<?>[] paramTypes)
null
, meaning "don't care".
If it is an lvalue expression, the parameter types must not be null
.
If it is literal text, the expected return type must not be void
.store
- used to get the parse tree from.functions
- the function mapper used to bind functionsvariables
- the variable mapper used to bind variablesexpr
- the expression stringreturnType
- the expected return type (may be null
)paramTypes
- the expected parameter types (must not be null
for lvalues)public MethodInfo getMethodInfo(ELContext context) throws ELException
getMethodInfo
in class MethodExpression
context
- used to resolve properties (base.property
and base[property]
)null
for literal expressionsELException
- if evaluation fails (e.g. suitable method not found)public String getExpressionString()
Expression
getExpressionString
in class Expression
public Object invoke(ELContext context, Object[] paramValues) throws ELException
invoke
in class MethodExpression
context
- used to resolve properties (base.property
and base[property]
)paramValues
- null
if this is a literal text expressionELException
- if evaluation fails (e.g. suitable method not found)public boolean isLiteralText()
Expression
isLiteralText
in class Expression
true
if this is a literal text expressionpublic boolean isParmetersProvided()
MethodExpression
This method must return true
if and only if parameters are specified in the EL,
using the expr-a.expr-b(...) syntax.
isParmetersProvided
in class MethodExpression
true
if this is a method invocation expressionpublic boolean isDeferred()
true
if this is a deferred expression (starting with #{
)public boolean equals(Object obj)
equals
in class Expression
obj
- the Object to test for equality.public int hashCode()
Expression
Expression.equals(Object)
method
on how two expressions can be equal if their expression Strings are different. Recall that if
two objects are equal according to the equals(Object) method, then calling the hashCode
method on each of the two objects must produce the same integer result. Implementations must
take special note and implement hashCode correctly.hashCode
in class Expression
Expression.equals(Object)
,
Hashtable
,
Object.hashCode()
public void dump(PrintWriter writer)
writer
- Copyright © 2018. All rights reserved.