Package de.odysseus.el
Class TreeMethodExpression
- java.lang.Object
-
- javax.el.Expression
-
- javax.el.MethodExpression
-
- de.odysseus.el.TreeMethodExpression
-
- All Implemented Interfaces:
java.io.Serializable
public final class TreeMethodExpression extends javax.el.MethodExpressionA method expression is ready to be evaluated (by calling eitherinvoke(ELContext, Object[])orgetMethodInfo(ELContext)). Instances of this class are usually created using anExpressionFactoryImpl.- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description private Bindingsbindingsprivate TreeBuilderbuilderprivate booleandeferredprivate java.lang.Stringexprprivate ExpressionNodenodeprivate static longserialVersionUIDprivate java.lang.Stringstructureprivate java.lang.Class<?>typeprivate java.lang.Class<?>[]types
-
Constructor Summary
Constructors Constructor Description TreeMethodExpression(TreeStore store, javax.el.FunctionMapper functions, javax.el.VariableMapper variables, TypeConverter converter, java.lang.String expr, java.lang.Class<?> returnType, java.lang.Class<?>[] paramTypes)Create a new method expression.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voiddump(java.io.PrintWriter writer)Print the parse tree.booleanequals(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.StringgetExpressionString()javax.el.MethodInfogetMethodInfo(javax.el.ELContext context)Evaluates the expression and answers information about the methodprivate java.lang.StringgetStructuralId()inthashCode()java.lang.Objectinvoke(javax.el.ELContext context, java.lang.Object[] paramValues)Evaluates the expression and invokes the method.booleanisDeferred()Answertrueif this is a deferred expression (starting with#{)booleanisLiteralText()booleanisParmetersProvided()private voidreadObject(java.io.ObjectInputStream in)java.lang.StringtoString()
-
-
-
Field Detail
-
serialVersionUID
private static final long serialVersionUID
- See Also:
- Constant Field Values
-
builder
private final TreeBuilder builder
-
bindings
private final Bindings bindings
-
expr
private final java.lang.String expr
-
type
private final java.lang.Class<?> type
-
types
private final java.lang.Class<?>[] types
-
deferred
private final boolean deferred
-
node
private transient ExpressionNode node
-
structure
private java.lang.String structure
-
-
Constructor Detail
-
TreeMethodExpression
public TreeMethodExpression(TreeStore store, javax.el.FunctionMapper functions, javax.el.VariableMapper variables, TypeConverter converter, java.lang.String expr, java.lang.Class<?> returnType, java.lang.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 benullfor lvalues)
-
-
Method Detail
-
getStructuralId
private java.lang.String getStructuralId()
-
getMethodInfo
public javax.el.MethodInfo getMethodInfo(javax.el.ELContext context) throws javax.el.ELExceptionEvaluates the expression and answers information about the method- Specified by:
getMethodInfoin classjavax.el.MethodExpression- Parameters:
context- used to resolve properties (base.propertyandbase[property])- Returns:
- method information or
nullfor literal expressions - Throws:
javax.el.ELException- if evaluation fails (e.g. suitable method not found)
-
getExpressionString
public java.lang.String getExpressionString()
- Specified by:
getExpressionStringin classjavax.el.Expression
-
invoke
public java.lang.Object invoke(javax.el.ELContext context, java.lang.Object[] paramValues) throws javax.el.ELExceptionEvaluates the expression and invokes the method.- Specified by:
invokein classjavax.el.MethodExpression- Parameters:
context- used to resolve properties (base.propertyandbase[property])paramValues-- Returns:
- method result or
nullif 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:
isLiteralTextin classjavax.el.Expression- Returns:
trueif this is a literal text expression
-
isParmetersProvided
public boolean isParmetersProvided()
- Overrides:
isParmetersProvidedin classjavax.el.MethodExpression- Returns:
trueif this is a method invocation expression
-
isDeferred
public boolean isDeferred()
Answertrueif this is a deferred expression (starting with#{)
-
equals
public 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. 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:
equalsin classjavax.el.Expression
-
hashCode
public int hashCode()
- Specified by:
hashCodein classjavax.el.Expression
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
dump
public void dump(java.io.PrintWriter writer)
Print the parse tree.- Parameters:
writer-
-
readObject
private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, java.lang.ClassNotFoundException- Throws:
java.io.IOExceptionjava.lang.ClassNotFoundException
-
-