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.CharSequence
expr
The JEXL string for this unified expression.protected JexlNode
node
The JEXL node for this unified expression.-
Fields inherited from class org.apache.commons.jexl3.internal.TemplateEngine.TemplateExpression
source
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
JexlBasedExpression(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.StringBuilder
asString(java.lang.StringBuilder strb)
Adds this expression's string representation to a StringBuilder.protected java.lang.Object
evaluate(Interpreter interpreter)
Interprets a sub-expression.(package private) JexlInfo
getInfo()
java.util.Set<java.util.List<java.lang.String>>
getVariables()
Gets the list of variables accessed by this expression.protected void
getVariables(Engine.VarCollector collector)
Fills up the list of variables accessed by this unified expression.protected JexlOptions
options(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.Expression
Adds 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.TemplateExpression
Interprets a sub-expression.- Specified by:
evaluate
in classTemplateEngine.TemplateExpression
- Parameters:
interpreter
- a JEXL interpreter- Returns:
- the result of interpretation
-
getInfo
JexlInfo getInfo()
- Overrides:
getInfo
in classTemplateEngine.TemplateExpression
- Returns:
- the info
-
getVariables
public java.util.Set<java.util.List<java.lang.String>> getVariables()
Description copied from interface:JxltEngine.Expression
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']).
- Specified by:
getVariables
in interfaceJxltEngine.Expression
- Overrides:
getVariables
in 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.TemplateExpression
Fills up the list of variables accessed by this unified expression.- Overrides:
getVariables
in classTemplateEngine.TemplateExpression
- Parameters:
collector
- the variable collector
-
options
protected JexlOptions options(JexlContext context)
Description copied from class:TemplateEngine.TemplateExpression
The options to use during evaluation.- Overrides:
options
in classTemplateEngine.TemplateExpression
- Parameters:
context
- the context- Returns:
- the options
-
-