Class TemplateEngine.JexlBasedExpression
- java.lang.Object
-
- org.apache.commons.jexl3.internal.TemplateEngine.TemplateExpression
-
- org.apache.commons.jexl3.internal.TemplateEngine.JexlBasedExpression
-
- All Implemented Interfaces:
JxltEngine.Expression
- Direct Known Subclasses:
TemplateEngine.DeferredExpression,TemplateEngine.ImmediateExpression,TemplateEngine.NestedExpression
- Enclosing class:
- TemplateEngine
abstract class TemplateEngine.JexlBasedExpression extends TemplateEngine.TemplateExpression
The base for JEXL based unified expressions.
-
-
Field Summary
Fields Modifier and Type Field Description protected java.lang.CharSequenceexprThe JEXL string for this unified expression.protected JexlNodenodeThe JEXL node for this unified expression.-
Fields inherited from class org.apache.commons.jexl3.internal.TemplateEngine.TemplateExpression
source
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedJexlBasedExpression(java.lang.CharSequence theExpr, JexlNode theNode, TemplateEngine.TemplateExpression theSource)Creates a JEXL interpretable unified expression.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.StringBuilderasString(java.lang.StringBuilder strb)Adds this expression's string representation to a StringBuilder.protected java.lang.Objectevaluate(Interpreter interpreter)Interprets a sub-expression.(package private) JexlInfogetInfo()java.util.Set<java.util.List<java.lang.String>>getVariables()Gets the list of variables accessed by this expression.protected voidgetVariables(Engine.VarCollector collector)Fills up the list of variables accessed by this unified expression.protected JexlOptionsoptions(JexlContext context)The options to use during evaluation.-
Methods inherited from class org.apache.commons.jexl3.internal.TemplateEngine.TemplateExpression
asString, evaluate, evaluate, getSource, getType, isDeferred, isImmediate, prepare, prepare, prepare, toString
-
-
-
-
Field Detail
-
expr
protected final java.lang.CharSequence expr
The JEXL string for this unified expression.
-
node
protected final JexlNode node
The JEXL node for this unified expression.
-
-
Constructor Detail
-
JexlBasedExpression
protected JexlBasedExpression(java.lang.CharSequence theExpr, JexlNode theNode, TemplateEngine.TemplateExpression theSource)Creates a JEXL interpretable unified expression.- Parameters:
theExpr- the unified expression as a stringtheNode- the unified expression as an ASTtheSource- the source unified expression if any
-
-
Method Detail
-
asString
public java.lang.StringBuilder asString(java.lang.StringBuilder strb)
Description copied from interface:JxltEngine.ExpressionAdds this expression's string representation to a StringBuilder.- Parameters:
strb- the builder to fill- Returns:
- the builder argument
-
evaluate
protected java.lang.Object evaluate(Interpreter interpreter)
Description copied from class:TemplateEngine.TemplateExpressionInterprets a sub-expression.- Specified by:
evaluatein classTemplateEngine.TemplateExpression- Parameters:
interpreter- a JEXL interpreter- Returns:
- the result of interpretation
-
getInfo
JexlInfo getInfo()
- Overrides:
getInfoin classTemplateEngine.TemplateExpression- Returns:
- the info
-
getVariables
public java.util.Set<java.util.List<java.lang.String>> getVariables()
Description copied from interface:JxltEngine.ExpressionGets 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']).
- Specified by:
getVariablesin interfaceJxltEngine.Expression- Overrides:
getVariablesin classTemplateEngine.TemplateExpression- 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
-
getVariables
protected void getVariables(Engine.VarCollector collector)
Description copied from class:TemplateEngine.TemplateExpressionFills up the list of variables accessed by this unified expression.- Overrides:
getVariablesin classTemplateEngine.TemplateExpression- Parameters:
collector- the variable collector
-
options
protected JexlOptions options(JexlContext context)
Description copied from class:TemplateEngine.TemplateExpressionThe options to use during evaluation.- Overrides:
optionsin classTemplateEngine.TemplateExpression- Parameters:
context- the context- Returns:
- the options
-
-