Class UnifiedJEXL.Expression
- Enclosing class:
- UnifiedJEXL
-
Field Summary
Modifier and TypeFieldDescriptionprotected final UnifiedJEXL.Expression
The source of this expression (seeprepare(edu.internet2.middleware.grouperClientExt.org.apache.commons.jexl2.JexlContext)
). -
Method Summary
Modifier and TypeMethodDescriptionasString()
Generates this expression's string representation.abstract StringBuilder
asString
(StringBuilder strb) Adds this expression's string representation to a StringBuilder.protected abstract Object
evaluate
(Interpreter interpreter) Intreprets a sub-expression.evaluate
(JexlContext context) Evaluates this expression.final UnifiedJEXL.Expression
Retrieves this expression's source expression.Gets the list of variables accessed by this expression.protected void
getVariables
(Set<List<String>> refs) Fills up the list of variables accessed by this expression.final boolean
Checks whether this expression is deferred.boolean
Checks whether this expression is immediate.protected UnifiedJEXL.Expression
prepare
(Interpreter interpreter) Prepares a sub-expression for interpretation.prepare
(JexlContext context) Evaluates the immediate sub-expressions.toString()
Formats this expression, adding its source string representation in comments if available: 'expression /*= source *\/'' .
-
Field Details
-
source
The source of this expression (seeprepare(edu.internet2.middleware.grouperClientExt.org.apache.commons.jexl2.JexlContext)
).
-
-
Method Details
-
isImmediate
public boolean isImmediate()Checks whether this expression is immediate.- Returns:
- true if immediate, false otherwise
-
isDeferred
public final boolean isDeferred()Checks whether this expression is deferred.- Returns:
- true if deferred, false otherwise
-
toString
Formats this expression, adding its source string representation in comments if available: 'expression /*= source *\/'' . Note: do not override; will be made final in a future release. -
asString
Generates this expression's string representation.- Returns:
- the string representation
-
asString
Adds this expression's string representation to a StringBuilder.- Parameters:
strb
- the builder to fill- Returns:
- the builder argument
-
getVariables
Gets the list of variables accessed by this expression.This method will visit all nodes of the sub-expressions and extract all variables whether they are written in 'dot' or 'bracketed' notation. (a.b is equivalent to a['b']).
- Returns:
- the set of variables, each as a list of strings (ant-ish variables use more than 1 string) or the empty set if no variables are used
- Since:
- 2.1
-
getVariables
Fills up the list of variables accessed by this expression.- Parameters:
refs
- the set of variable being filled- Since:
- 2.1
-
prepare
Evaluates the immediate sub-expressions.When the expression is dependant upon immediate and deferred sub-expressions, evaluates the immediate sub-expressions with the context passed as parameter and returns this expression deferred form.
In effect, this binds the result of the immediate sub-expressions evaluation in the context, allowing to differ evaluation of the remaining (deferred) expression within another context. This only has an effect to nested & composite expressions that contain differed & immediate sub-expressions.
If the underlying JEXL engine is silent, errors will be logged through its logger as warning.
Note: do not override; will be made final in a future release.- Parameters:
context
- the context to use for immediate expression evaluations- Returns:
- an expression or null if an error occurs and the
JexlEngine
is running in silent mode - Throws:
UnifiedJEXL.Exception
- if an error occurs and theJexlEngine
is not in silent mode
-
evaluate
Evaluates this expression.If the underlying JEXL engine is silent, errors will be logged through its logger as warning.
Note: do not override; will be made final in a future release.- Parameters:
context
- the variable context- Returns:
- the result of this expression evaluation or null if an error occurs and the
JexlEngine
is running in silent mode - Throws:
UnifiedJEXL.Exception
- if an error occurs and theJexlEngine
is not silent
-
getSource
Retrieves this expression's source expression. If this expression was prepared, this allows to retrieve the original expression that lead to it. Other expressions return themselves.- Returns:
- the source expression
-
prepare
Prepares a sub-expression for interpretation.- Parameters:
interpreter
- a JEXL interpreter- Returns:
- a prepared expression
- Throws:
JexlException
- (only for nested & composite)
-
evaluate
Intreprets a sub-expression.- Parameters:
interpreter
- a JEXL interpreter- Returns:
- the result of interpretation
- Throws:
JexlException
- (only for nested & composite)
-