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 (package private) TemplateEngine.TemplateExpression[]exprsThe list of sub-expression resulting from parsing.private intmetaBit 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.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) TemplateEngine.ExpressionTypegetType()Gets this TemplateExpression type.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.booleanisImmediate()Checks whether this expression is immediate.protected TemplateEngine.TemplateExpressionprepare(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
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.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
-
getType
TemplateEngine.ExpressionType getType()
Description copied from class:TemplateEngine.TemplateExpressionGets this TemplateExpression type.- Specified by:
getTypein classTemplateEngine.TemplateExpression- Returns:
- its type
-
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)
Fills up the list of variables accessed by this unified expression.- Overrides:
getVariablesin classTemplateEngine.TemplateExpression- Parameters:
collector- the variable collector
-
isImmediate
public boolean isImmediate()
Description copied from interface:JxltEngine.ExpressionChecks whether this expression is immediate.- Specified by:
isImmediatein interfaceJxltEngine.Expression- Overrides:
isImmediatein classTemplateEngine.TemplateExpression- Returns:
- true if immediate, false otherwise
-
prepare
protected TemplateEngine.TemplateExpression prepare(Interpreter interpreter)
Description copied from class:TemplateEngine.TemplateExpressionPrepares a sub-expression for interpretation.- Overrides:
preparein classTemplateEngine.TemplateExpression- Parameters:
interpreter- a JEXL interpreter- Returns:
- a prepared unified expression
-
-