Class TreeMethodExpression
java.lang.Object
org.flowable.common.engine.impl.javax.el.Expression
org.flowable.common.engine.impl.javax.el.MethodExpression
org.flowable.common.engine.impl.de.odysseus.el.TreeMethodExpression
- All Implemented Interfaces:
Serializable
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.- Author:
- Christoph Beck
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionTreeMethodExpression(TreeStore store, FunctionMapper functions, VariableMapper variables, TypeConverter converter, String expr, Class<?> returnType, Class<?>[] paramTypes) Create a new method expression. -
Method Summary
Modifier and TypeMethodDescriptionvoiddump(PrintWriter writer) Print the parse tree.booleanExpressions 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.Returns the original String used to create this Expression, unmodified.getMethodInfo(ELContext context) Evaluates the expression and answers information about the methodinthashCode()Returns the hash code for this Expression.Evaluates the expression and invokes the method.booleanAnswertrueif this is a deferred expression (starting with#{)booleanReturns whether this expression was created from only literal text.booleanReturn whether this MethodExpression was created with parameters.toString()
-
Constructor Details
-
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 Details
-
getMethodInfo
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
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
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 delimiters (${...} 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
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:
-
toString
-
dump
Print the parse tree.- Parameters:
writer-
-