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:
java.io.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, 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 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 methodint
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()
Answertrue
if this is a deferred expression (starting with#{
)boolean
isLiteralText()
Returns whether this expression was created from only literal text.boolean
isParmetersProvided()
Return whether this MethodExpression was created with parameters.java.lang.String
toString()
-
-
-
Constructor Detail
-
TreeMethodExpression
public TreeMethodExpression(TreeStore store, FunctionMapper functions, 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 benull
for lvalues)
-
-
Method Detail
-
getMethodInfo
public MethodInfo getMethodInfo(ELContext context) throws ELException
Evaluates the expression and answers information about the method- Specified by:
getMethodInfo
in classMethodExpression
- Parameters:
context
- used to resolve properties (base.property
andbase[property]
)- Returns:
- method information or
null
for literal expressions - Throws:
ELException
- if evaluation fails (e.g. suitable method not found)
-
getExpressionString
public java.lang.String getExpressionString()
Description copied from class:Expression
Returns 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:
getExpressionString
in classExpression
- Returns:
- The original expression String.
-
invoke
public java.lang.Object invoke(ELContext context, java.lang.Object[] paramValues) throws ELException
Evaluates the expression and invokes the method.- Specified by:
invoke
in classMethodExpression
- Parameters:
context
- used to resolve properties (base.property
andbase[property]
)paramValues
-- Returns:
- method result or
null
if 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:Expression
Returns 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:
isLiteralText
in classExpression
- Returns:
true
if this is a literal text expression
-
isParmetersProvided
public boolean isParmetersProvided()
Description copied from class:MethodExpression
Return whether this MethodExpression was created with parameters.This method must return
true
if and only if parameters are specified in the EL, using the expr-a.expr-b(...) syntax.- Overrides:
isParmetersProvided
in classMethodExpression
- Returns:
true
if this is a method invocation expression
-
isDeferred
public boolean isDeferred()
Answertrue
if 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:
equals
in 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:Expression
Returns 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:
hashCode
in classExpression
- Returns:
- The hash code for this Expression.
- See Also:
Expression.equals(Object)
,Hashtable
,Object.hashCode()
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
dump
public void dump(java.io.PrintWriter writer)
Print the parse tree.- Parameters:
writer
-
-
-