Package org.camunda.bpm.engine.impl.juel
Class TreeMethodExpression
- java.lang.Object
-
- org.camunda.bpm.engine.impl.javax.el.Expression
-
- org.camunda.bpm.engine.impl.javax.el.MethodExpression
-
- org.camunda.bpm.engine.impl.juel.TreeMethodExpression
-
- All Implemented Interfaces:
Serializable
public final class TreeMethodExpression extends MethodExpression
A method expression is ready to be evaluated (by calling eitherinvoke(ELContext, Object[])orgetMethodInfo(ELContext)). Instances of this class are usually created using anExpressionFactoryImpl.- Author:
- Christoph Beck
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description TreeMethodExpression(TreeStore store, FunctionMapper functions, VariableMapper variables, TypeConverter converter, String expr, Class<?> returnType, Class<?>[] paramTypes)Create a new method expression.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voiddump(PrintWriter writer)Print the parse tree.booleanequals(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.StringgetExpressionString()Returns the original String used to create this Expression, unmodified.MethodInfogetMethodInfo(ELContext context)Evaluates the expression and answers information about the methodinthashCode()Returns the hash code for this Expression.Objectinvoke(ELContext context, Object[] paramValues)Evaluates the expression and invokes the method.booleanisDeferred()Answertrueif this is a deferred expression (starting with#{)booleanisLiteralText()Returns whether this expression was created from only literal text.booleanisParmetersProvided()Return whether this MethodExpression was created with parameters.StringtoString()
-
-
-
Constructor Detail
-
TreeMethodExpression
public TreeMethodExpression(TreeStore store, FunctionMapper functions, 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 benullfor lvalues)
-
-
Method Detail
-
getMethodInfo
public MethodInfo getMethodInfo(ELContext context) throws ELException
Evaluates the expression and answers information about the method- Specified by:
getMethodInfoin classMethodExpression- Parameters:
context- used to resolve properties (base.propertyandbase[property])- Returns:
- method information or
nullfor literal expressions - Throws:
ELException- if evaluation fails (e.g. suitable method not found)
-
getExpressionString
public String getExpressionString()
Description copied from class:ExpressionReturns the original String used to create this 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.- Specified by:
getExpressionStringin classExpression- Returns:
- The original expression String.
-
invoke
public Object invoke(ELContext context, Object[] paramValues) throws ELException
Evaluates the expression and invokes the method.- Specified by:
invokein classMethodExpression- Parameters:
context- used to resolve properties (base.propertyandbase[property])paramValues-- Returns:
- method result or
nullif this is a literal text expression - Throws:
ELException- if evaluation fails (e.g. suitable method not found)
-
isLiteralText
public boolean isLiteralText()
Description copied from class:ExpressionReturns whether this expression was created from only literal text. This method must return true if and only if the expression string this expression was created from contained no unescaped EL delimeters (${...} or #{...}).- Specified by:
isLiteralTextin classExpression- Returns:
trueif this is a literal text expression
-
isParmetersProvided
public boolean isParmetersProvided()
Description copied from class:MethodExpressionReturn whether this MethodExpression was created with parameters.This method must return
trueif and only if parameters are specified in the EL, using the expr-a.expr-b(...) syntax.- Overrides:
isParmetersProvidedin classMethodExpression- Returns:
trueif this is a method invocation expression
-
isDeferred
public boolean isDeferred()
Answertrueif this is a deferred expression (starting with#{)
-
equals
public 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. 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 classExpression- Parameters:
obj- the Object to test for equality.- Returns:
- true if obj equals this Expression; false otherwise.
-
hashCode
public int hashCode()
Description copied from class:ExpressionReturns the hash code for this Expression. See the note in theExpression.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.- Specified by:
hashCodein classExpression- Returns:
- The hash code for this Expression.
- See Also:
Expression.equals(Object),Hashtable,Object.hashCode()
-
dump
public void dump(PrintWriter writer)
Print the parse tree.- Parameters:
writer-
-
-