public class VelocimacroProxy extends Directive
Modifier and Type | Field and Description |
---|---|
private java.lang.String |
bodyReference |
private boolean |
enableBCmode |
private java.lang.String[] |
literalArgArray |
private java.util.List<Macro.MacroArg> |
macroArgs |
private java.lang.String |
macroName |
private int |
maxCallDepth |
private SimpleNode |
nodeTree |
private static java.lang.Object |
NULL_VALUE_MARKER |
private int |
numMacroArgs |
private boolean |
strictArguments |
BLOCK, LINE
Constructor and Description |
---|
VelocimacroProxy() |
Modifier and Type | Method and Description |
---|---|
protected void |
checkArgumentCount(Node node,
int callArgNum)
Check whether the number of arguments given matches the number defined.
|
protected void |
checkDepth(InternalContextAdapter context)
check that we aren't already at the max call depth and throws
a MacroOverflowException if we are there.
|
java.util.List<Macro.MacroArg> |
getMacroArgs()
Return the list of macro arguments associated with this macro
|
java.lang.String |
getName()
Return name of this Velocimacro.
|
int |
getNumArgs()
returns the number of ars needed for this VM
|
int |
getType()
Velocimacros are always LINE type directives.
|
protected java.lang.Object[] |
handleArgValues(InternalContextAdapter context,
Node node,
int callArgNum)
Gets the macro argument values and puts them in the context under
the argument names.
|
void |
init(RuntimeServices rs)
Initialize members of VelocimacroProxy.
|
boolean |
render(InternalContextAdapter context,
java.io.Writer writer,
Node node)
Render the macro AST node
|
boolean |
render(InternalContextAdapter context,
java.io.Writer writer,
Node node,
Renderable body)
Renders the macro using the context.
|
void |
setMacroArgs(java.util.List<Macro.MacroArg> args)
sets the array of arguments specified in the macro definition
|
void |
setName(java.lang.String name)
sets the directive name of this VM
|
void |
setNodeTree(SimpleNode tree) |
checkArgs, getColumn, getLine, getScopeName, getTemplate, getTemplateName, init, isScopeProvided, makeScope, postRender, preRender, setLocation, setLocation
private java.lang.String macroName
private java.util.List<Macro.MacroArg> macroArgs
private java.lang.String[] literalArgArray
private SimpleNode nodeTree
private int numMacroArgs
private boolean strictArguments
private int maxCallDepth
private java.lang.String bodyReference
private boolean enableBCmode
private static final java.lang.Object NULL_VALUE_MARKER
public java.lang.String getName()
public int getType()
public void setName(java.lang.String name)
name
- public void setMacroArgs(java.util.List<Macro.MacroArg> args)
args
- Array of macro arguments, containing the
#macro() arguments and default values. the 0th is the name.public java.util.List<Macro.MacroArg> getMacroArgs()
public void setNodeTree(SimpleNode tree)
tree
- public int getNumArgs()
public void init(RuntimeServices rs)
rs
- runtime servicespublic boolean render(InternalContextAdapter context, java.io.Writer writer, Node node) throws java.io.IOException
public boolean render(InternalContextAdapter context, java.io.Writer writer, Node node, Renderable body) throws java.io.IOException
context
- Current rendering contextwriter
- Writer for outputnode
- AST that calls the macrobody
- the macro bodyjava.io.IOException
protected void checkArgumentCount(Node node, int callArgNum)
node
- callArgNum
- protected void checkDepth(InternalContextAdapter context)
context
- protected java.lang.Object[] handleArgValues(InternalContextAdapter context, Node node, int callArgNum)
context
- node
- callArgNum
-