Class Macro
- java.lang.Object
-
- com.google.auto.value.processor.escapevelocity.Macro
-
class Macro extends java.lang.ObjectA macro definition. Macros appear in templates using the syntax#macro (m $x $y) ... #endand each one produces an instance of this class. Evaluating a macro involves setting the parameters (here {$x $y)} and evaluating the macro body. Macro arguments are call-by-name, which means that we need to set each parameter variable to the node in the parse tree that corresponds to it, and arrange for that node to be evaluated when the variable is actually referenced.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description (package private) static classMacro.MacroEvaluationContextThe context for evaluation within macros.
-
Field Summary
Fields Modifier and Type Field Description private Nodebodyprivate intdefinitionLineNumberprivate java.lang.Stringnameprivate com.google.common.collect.ImmutableList<java.lang.String>parameterNames
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description (package private) java.lang.Objectevaluate(EvaluationContext context, java.util.List<Node> thunks)(package private) java.lang.Stringname()(package private) intparameterCount()
-
-
-
Field Detail
-
definitionLineNumber
private final int definitionLineNumber
-
name
private final java.lang.String name
-
parameterNames
private final com.google.common.collect.ImmutableList<java.lang.String> parameterNames
-
body
private final Node body
-
-
Constructor Detail
-
Macro
Macro(int definitionLineNumber, java.lang.String name, java.util.List<java.lang.String> parameterNames, Node body)
-
-
Method Detail
-
name
java.lang.String name()
-
parameterCount
int parameterCount()
-
evaluate
java.lang.Object evaluate(EvaluationContext context, java.util.List<Node> thunks)
-
-