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)
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, setLocationpublic String getName()
public int getType()
public boolean isScopeProvided()
isScopeProvided in class Directivepublic boolean render(InternalContextAdapter context, Writer writer, Node node) throws IOException
render in class Directivecontext - writer - node - IOExceptionpublic void init(RuntimeServices rs, InternalContextAdapter context, Node node) throws TemplateInitException
Directivepublic void checkArgs(ArrayList<Integer> argtypes, Token t, String templateName) throws ParseException
checkArgs in class Directiveargtypes - 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.ParseExceptionpublic static StringBuilder macroToString(StringBuilder buf, List<Macro.MacroArg> macroArgs)
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–2019 The Apache Software Foundation. All rights reserved.