public class Macro extends Directive
Modifier and Type | Class and Description |
---|---|
static class |
Macro.MacroArg
MacroArgs holds the information for a single argument in a
macro definition.
|
BLOCK, LINE
Constructor and Description |
---|
Macro() |
Modifier and Type | Method and Description |
---|---|
void |
checkArgs(ArrayList<Integer> argtypes,
Token t,
String templateName)
Check the argument types of a macro call, called by the parser to do validation
|
String |
getName()
Return name of this directive.
|
int |
getType()
Return type of this directive.
|
void |
init(RuntimeServices rs,
InternalContextAdapter context,
Node node)
How this directive is to be initialized.
|
boolean |
isScopeProvided()
Since this class does no processing of content,
there is never a need for an internal scope.
|
static StringBuilder |
macroToString(StringBuilder buf,
List<Macro.MacroArg> macroArgs,
RuntimeServices rsvc)
For debugging purposes.
|
boolean |
render(InternalContextAdapter context,
Writer writer,
Node node)
render() doesn't do anything in the final output rendering.
|
getColumn, getLine, getScopeName, getTemplate, getTemplateName, makeScope, postRender, preRender, setLocation, setLocation
public String getName()
public int getType()
public boolean isScopeProvided()
isScopeProvided
in class Directive
public boolean render(InternalContextAdapter context, Writer writer, Node node) throws IOException
render
in class Directive
context
- writer
- node
- IOException
public void init(RuntimeServices rs, InternalContextAdapter context, Node node) throws TemplateInitException
Directive
public void checkArgs(ArrayList<Integer> argtypes, Token t, String templateName) throws ParseException
checkArgs
in class Directive
argtypes
- type, Array of argument types of each argument to the directive
for example ParserTreeConstants.JJTWORDt
- token of directivetemplateName
- the name of the template this directive is referenced in.ParseException
public static StringBuilder macroToString(StringBuilder buf, List<Macro.MacroArg> macroArgs, RuntimeServices rsvc)
argArray
and appends them to buf
.buf
- A StringBuilder. If null, a new StringBuilder is allocated.macroArgs
- Array of macro arguments, containing the
#macro() arguments and default values. the 0th is the name.Copyright © 2000–2020 The Apache Software Foundation. All rights reserved.