|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjavax.el.Expression
javax.el.MethodExpression
de.odysseus.el.TreeMethodExpression
public final class TreeMethodExpression
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
.
Constructor Summary | |
---|---|
TreeMethodExpression(TreeStore store,
FunctionMapper functions,
VariableMapper variables,
java.lang.String expr,
java.lang.Class<?> returnType,
java.lang.Class<?>[] paramTypes)
Create a new method expression. |
Method Summary | |
---|---|
void |
dump(java.io.PrintWriter writer)
Print the parse tree. |
boolean |
equals(java.lang.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. |
java.lang.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 . |
java.lang.Object |
invoke(ELContext context,
java.lang.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. |
java.lang.String |
toString()
|
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public TreeMethodExpression(TreeStore store, FunctionMapper functions, VariableMapper variables, java.lang.String expr, java.lang.Class<?> returnType, java.lang.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)Method Detail |
---|
public MethodInfo getMethodInfo(ELContext context) throws ELException
getMethodInfo
in class MethodExpression
context
- used to resolve properties (base.property
and base[property]
)
null
for literal expressions
ELException
- if evaluation fails (e.g. suitable method not found)public java.lang.String getExpressionString()
Expression
Expression
,
unmodified.
This is used for debugging purposes but also for the purposes of comparison (e.g. to ensure the expression in a configuration file has not changed).
This method does not provide sufficient information to
re-create an expression. Two different expressions can have exactly
the same expression string but different function mappings.
Serialization should be used to save and restore the state of an
Expression
.
getExpressionString
in class Expression
public java.lang.Object invoke(ELContext context, java.lang.Object[] paramValues) throws ELException
invoke
in class MethodExpression
context
- used to resolve properties (base.property
and base[property]
)paramValues
- The parameters to pass to the method, or
null
if no parameters.
null
if this is a literal text expression
ELException
- if evaluation fails (e.g. suitable method not found)public boolean isLiteralText()
Expression
This method must return true
if and only if the
expression string this expression was created from contained no
unescaped EL delimeters (${...}
or
#{...}
).
isLiteralText
in class Expression
true
if this is a literal text expressionpublic boolean isDeferred()
true
if this is a deferred expression (starting with #{
)
public boolean equals(java.lang.Object obj)
null
and the other is Object.class
.
For non-text method expressions, the expected types match if both types are the same
or one of them is null
.
equals
in class Expression
obj
- the Object
to test for equality.
true
if obj
equals this
Expression
; false
otherwise.Hashtable
,
Object.equals(java.lang.Object)
public int hashCode()
Expression
Expression
.
See the note in the Expression.equals(java.lang.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
.Expression.equals(java.lang.Object)
,
Hashtable
,
Object.hashCode()
public java.lang.String toString()
toString
in class java.lang.Object
public void dump(java.io.PrintWriter writer)
writer
-
|
Copyright © 2006, 2007 Odysseus Software GmbH. | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |