Class DirectiveNode.ForEachNode
java.lang.Object
com.google.auto.value.processor.escapevelocity.Node
com.google.auto.value.processor.escapevelocity.DirectiveNode
com.google.auto.value.processor.escapevelocity.DirectiveNode.ForEachNode
- Enclosing class:
DirectiveNode
A node in the parse tree representing a
#foreach
construct. While evaluating
#foreach ($x in $things)
, {$code $x} will be set to each element of $things
in
turn. Once the loop completes, $x
will go back to whatever value it had before, which
might be undefined. During loop execution, the variable $foreach
is also defined.
Velocity defines a number of properties in this variable, but here we only support
$foreach.hasNext
.-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate static class
This class is the type of the variable$foreach
that is defined within#foreach
loops.Nested classes/interfaces inherited from class com.google.auto.value.processor.escapevelocity.DirectiveNode
DirectiveNode.ForEachNode, DirectiveNode.IfNode, DirectiveNode.MacroCallNode, DirectiveNode.SetNode
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final Node
private final ExpressionNode
private final String
Fields inherited from class com.google.auto.value.processor.escapevelocity.Node
lineNumber, resourceName
-
Constructor Summary
ConstructorsConstructorDescriptionForEachNode
(String resourceName, int lineNumber, String var, ExpressionNode in, Node body) -
Method Summary
Modifier and TypeMethodDescription(package private) Object
evaluate
(EvaluationContext context) Returns the result of evaluating this node in the given context.Methods inherited from class com.google.auto.value.processor.escapevelocity.Node
cons, emptyNode, evaluationException, evaluationException
-
Field Details
-
var
-
collection
-
body
-
-
Constructor Details
-
ForEachNode
ForEachNode(String resourceName, int lineNumber, String var, ExpressionNode in, Node body)
-
-
Method Details
-
evaluate
Description copied from class:Node
Returns the result of evaluating this node in the given context. This result may be used as part of a further operation, for example evaluating2 + 3
to 5 in order to set$x
to 5 in#set ($x = 2 + 3)
. Or it may be used directly as part of the template output, for example evaluating replacingname
byFred
inMy name is $name.
.
-