Class DirectiveNode.MacroCallNode
- java.lang.Object
-
- com.google.auto.value.processor.escapevelocity.Node
-
- com.google.auto.value.processor.escapevelocity.DirectiveNode
-
- com.google.auto.value.processor.escapevelocity.DirectiveNode.MacroCallNode
-
- Enclosing class:
- DirectiveNode
static class DirectiveNode.MacroCallNode extends DirectiveNode
A node in the parse tree representing a macro call. If the template contains a definition like#macro (mymacro $x $y) ... #end
, then a call of that macro looks like#mymacro (xvalue yvalue)
. The call is represented by an instance of this class. The definition itself does not appear in the parse tree.Evaluating a macro involves temporarily setting the parameter variables (
$x $y
in the example) to thunks representing the argument expressions, evaluating the macro body, and restoring any previous values that the parameter variables had.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class com.google.auto.value.processor.escapevelocity.DirectiveNode
DirectiveNode.ForEachNode, DirectiveNode.IfNode, DirectiveNode.MacroCallNode, DirectiveNode.SetNode
-
-
Field Summary
Fields Modifier and Type Field Description private Macro
macro
private java.lang.String
name
private com.google.common.collect.ImmutableList<Node>
thunks
-
Fields inherited from class com.google.auto.value.processor.escapevelocity.Node
lineNumber, resourceName
-
-
Constructor Summary
Constructors Constructor Description MacroCallNode(java.lang.String resourceName, int lineNumber, java.lang.String name, com.google.common.collect.ImmutableList<Node> argumentNodes)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description (package private) int
argumentCount()
(package private) java.lang.Object
evaluate(EvaluationContext context)
Returns the result of evaluating this node in the given context.(package private) java.lang.String
name()
(package private) void
setMacro(Macro macro)
-
Methods inherited from class com.google.auto.value.processor.escapevelocity.Node
cons, emptyNode, evaluationException, evaluationException
-
-
-
-
Constructor Detail
-
MacroCallNode
MacroCallNode(java.lang.String resourceName, int lineNumber, java.lang.String name, com.google.common.collect.ImmutableList<Node> argumentNodes)
-
-
Method Detail
-
name
java.lang.String name()
-
argumentCount
int argumentCount()
-
setMacro
void setMacro(Macro macro)
-
evaluate
java.lang.Object evaluate(EvaluationContext context)
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.
.
-
-