public class VelocimacroProxy extends Directive
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.
|
List<Macro.MacroArg> |
getMacroArgs()
Return the list of macro arguments associated with this macro
|
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 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,
Writer writer,
Node node)
Render the macro AST node
|
boolean |
render(InternalContextAdapter context,
Writer writer,
Node node,
Renderable body)
Renders the macro using the context.
|
void |
setMacroArgs(List<Macro.MacroArg> args)
sets the array of arguments specified in the macro definition
|
void |
setName(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
public String getName()
public int getType()
public void setName(String name)
name
- public void setMacroArgs(List<Macro.MacroArg> args)
args
- Array of macro arguments, containing the
#macro() arguments and default values. the 0th is the name.public 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, Writer writer, Node node) throws IOException
render
in class Directive
context
- writer
- node
- IOException
public boolean render(InternalContextAdapter context, Writer writer, Node node, Renderable body) throws IOException
context
- Current rendering contextwriter
- Writer for outputnode
- AST that calls the macrobody
- the macro bodyIOException
protected void checkArgumentCount(Node node, int callArgNum)
node
- callArgNum
- protected void checkDepth(InternalContextAdapter context)
context
- protected Object[] handleArgValues(InternalContextAdapter context, Node node, int callArgNum)
context
- node
- callArgNum
- Copyright © 2000–2021 The Apache Software Foundation. All rights reserved.