Package de.odysseus.el
Class TreeMethodExpression
java.lang.Object
javax.el.Expression
javax.el.MethodExpression
de.odysseus.el.TreeMethodExpression
- All Implemented Interfaces:
Serializable
public final class TreeMethodExpression
extends javax.el.MethodExpression
A method expression is ready to be evaluated (by calling either
invoke(ELContext, Object[])
or getMethodInfo(ELContext)
).
Instances of this class are usually created using an ExpressionFactoryImpl
.- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final Bindings
private final TreeBuilder
private final boolean
private final String
private ExpressionNode
private static final long
private String
private final Class
<?> private final Class<?>[]
-
Constructor Summary
ConstructorsConstructorDescriptionTreeMethodExpression
(TreeStore store, javax.el.FunctionMapper functions, javax.el.VariableMapper variables, TypeConverter converter, String expr, Class<?> returnType, Class<?>[] paramTypes) Create a new method expression. -
Method Summary
Modifier and TypeMethodDescriptionvoid
dump
(PrintWriter writer) Print the parse tree.boolean
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.javax.el.MethodInfo
getMethodInfo
(javax.el.ELContext context) Evaluates the expression and answers information about the methodprivate String
int
hashCode()
Evaluates the expression and invokes the method.boolean
Answertrue
if this is a deferred expression (starting with#{
)boolean
boolean
private void
toString()
Methods inherited from class javax.el.MethodExpression
isParametersProvided
-
Field Details
-
serialVersionUID
private static final long serialVersionUID- See Also:
-
builder
-
bindings
-
expr
-
type
-
types
-
deferred
private final boolean deferred -
node
-
structure
-
-
Constructor Details
-
TreeMethodExpression
public TreeMethodExpression(TreeStore store, javax.el.FunctionMapper functions, javax.el.VariableMapper variables, TypeConverter converter, String expr, Class<?> returnType, Class<?>[] paramTypes) Create a new method expression. The expression must be an lvalue expression or literal text. The expected return type may benull
, meaning "don't care". If it is an lvalue expression, the parameter types must not benull
. If it is literal text, the expected return type must not bevoid
.- Parameters:
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 benull
)paramTypes
- the expected parameter types (must not benull
for lvalues)
-
-
Method Details
-
getStructuralId
-
getMethodInfo
public javax.el.MethodInfo getMethodInfo(javax.el.ELContext context) throws javax.el.ELException Evaluates the expression and answers information about the method- Specified by:
getMethodInfo
in classjavax.el.MethodExpression
- Parameters:
context
- used to resolve properties (base.property
andbase[property]
)- Returns:
- method information or
null
for literal expressions - Throws:
javax.el.ELException
- if evaluation fails (e.g. suitable method not found)
-
getExpressionString
- Specified by:
getExpressionString
in classjavax.el.Expression
-
invoke
Evaluates the expression and invokes the method.- Specified by:
invoke
in classjavax.el.MethodExpression
- Parameters:
context
- used to resolve properties (base.property
andbase[property]
)paramValues
-- Returns:
- method result or
null
if this is a literal text expression - Throws:
javax.el.ELException
- if evaluation fails (e.g. suitable method not found)
-
isLiteralText
public boolean isLiteralText()- Specified by:
isLiteralText
in classjavax.el.Expression
- Returns:
true
if this is a literal text expression
-
isParmetersProvided
public boolean isParmetersProvided()- Overrides:
isParmetersProvided
in classjavax.el.MethodExpression
- Returns:
true
if this is a method invocation expression
-
isDeferred
public boolean isDeferred()Answertrue
if this is a deferred expression (starting with#{
) -
equals
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. Two method expressions are equal if- their builders are equal
- their structural id's are equal
- their bindings are equal
- their expected types match
- their parameter types are equal
- Specified by:
equals
in classjavax.el.Expression
-
hashCode
public int hashCode()- Specified by:
hashCode
in classjavax.el.Expression
-
toString
-
dump
Print the parse tree.- Parameters:
writer
-
-
readObject
- Throws:
IOException
ClassNotFoundException
-