Class TemplateEngine.CompositeExpression
java.lang.Object
org.apache.commons.jexl3.internal.TemplateEngine.TemplateExpression
org.apache.commons.jexl3.internal.TemplateEngine.CompositeExpression
- All Implemented Interfaces:
JxltEngine.Expression
- Enclosing class:
- TemplateEngine
A composite unified expression: "... ${...} ... #{...} ...".
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final TemplateEngine.TemplateExpression[]
The list of sub-expression resulting from parsing.private final int
Bit encoded (deferred count > 0) bit 1, (immediate count > 0) bit 0.Fields inherited from class org.apache.commons.jexl3.internal.TemplateEngine.TemplateExpression
source
-
Constructor Summary
ConstructorsConstructorDescriptionCompositeExpression
(int[] counters, List<TemplateEngine.TemplateExpression> list, TemplateEngine.TemplateExpression src) Creates a composite expression. -
Method Summary
Modifier and TypeMethodDescriptionasString
(StringBuilder strb) Adds this expression's string representation to a StringBuilder.protected Object
evaluate
(Interpreter interpreter) Interprets a sub-expression.(package private) TemplateEngine.ExpressionType
getType()
Gets this TemplateExpression type.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.boolean
Checks whether this expression is immediate.protected TemplateEngine.TemplateExpression
prepare
(Interpreter interpreter) Prepares a sub-expression for interpretation.
-
Field Details
-
meta
private final int metaBit encoded (deferred count > 0) bit 1, (immediate count > 0) bit 0. -
exprs
The list of sub-expression resulting from parsing.
-
-
Constructor Details
-
CompositeExpression
CompositeExpression(int[] counters, List<TemplateEngine.TemplateExpression> list, TemplateEngine.TemplateExpression src) Creates a composite expression.- Parameters:
counters
- counters of expressions per typelist
- the sub-expressionssrc
- the source for this expression if any
-
-
Method Details
-
isImmediate
public boolean isImmediate()Description copied from interface:JxltEngine.Expression
Checks whether this expression is immediate.- Specified by:
isImmediate
in interfaceJxltEngine.Expression
- Overrides:
isImmediate
in classTemplateEngine.TemplateExpression
- Returns:
- true if immediate, false otherwise
-
getType
TemplateEngine.ExpressionType getType()Description copied from class:TemplateEngine.TemplateExpression
Gets this TemplateExpression type.- Specified by:
getType
in classTemplateEngine.TemplateExpression
- Returns:
- its type
-
asString
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
-
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
Fills up the list of variables accessed by this unified expression.- Overrides:
getVariables
in classTemplateEngine.TemplateExpression
- Parameters:
collector
- the variable collector
-
prepare
Description copied from class:TemplateEngine.TemplateExpression
Prepares a sub-expression for interpretation.- Overrides:
prepare
in classTemplateEngine.TemplateExpression
- Parameters:
interpreter
- a JEXL interpreter- Returns:
- a prepared unified expression
-
evaluate
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
-