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
final class TemplateEngine.CompositeExpression extends TemplateEngine.TemplateExpression
A composite unified expression: "... ${...} ... #{...} ...".
-
-
Field Summary
Fields Modifier and Type Field Description protected TemplateEngine.TemplateExpression[]
exprs
The list of sub-expression resulting from parsing.private int
meta
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
Constructors Constructor Description CompositeExpression(int[] counters, java.util.List<TemplateEngine.TemplateExpression> list, TemplateEngine.TemplateExpression src)
Creates a composite 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) TemplateEngine.ExpressionType
getType()
Gets this TemplateExpression type.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.boolean
isImmediate()
Checks whether this expression is immediate.protected TemplateEngine.TemplateExpression
prepare(Interpreter interpreter)
Prepares a sub-expression for interpretation.
-
-
-
Field Detail
-
meta
private final int meta
Bit encoded (deferred count > 0) bit 1, (immediate count > 0) bit 0.
-
exprs
protected final TemplateEngine.TemplateExpression[] exprs
The list of sub-expression resulting from parsing.
-
-
Constructor Detail
-
CompositeExpression
CompositeExpression(int[] counters, java.util.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 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
-
getType
TemplateEngine.ExpressionType getType()
Description copied from class:TemplateEngine.TemplateExpression
Gets this TemplateExpression type.- Specified by:
getType
in classTemplateEngine.TemplateExpression
- Returns:
- its type
-
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)
Fills up the list of variables accessed by this unified expression.- Overrides:
getVariables
in classTemplateEngine.TemplateExpression
- Parameters:
collector
- the variable collector
-
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
-
prepare
protected TemplateEngine.TemplateExpression prepare(Interpreter interpreter)
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
-
-