|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.apache.velocity.runtime.directive.Directive
org.apache.velocity.runtime.directive.Macro
public class Macro
Macro implements the macro definition directive of VTL. example : #macro( isnull $i ) #if( $i ) $i #end #end This object is used at parse time to mainly process and register the macro. It is used inline in the parser when processing a directive.
| Nested Class Summary | |
|---|---|
static class |
Macro.MacroArg
MacroArgs holds the information for a single argument in a macro definition. |
| Field Summary |
|---|
| Fields inherited from class org.apache.velocity.runtime.directive.Directive |
|---|
rsvc |
| Fields inherited from interface org.apache.velocity.runtime.directive.DirectiveConstants |
|---|
BLOCK, LINE |
| Constructor Summary | |
|---|---|
Macro()
|
|
| Method Summary | |
|---|---|
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 StringBuffer |
macroToString(StringBuffer 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. |
| Methods inherited from class org.apache.velocity.runtime.directive.Directive |
|---|
getColumn, getLine, getScopeName, getTemplateName, makeScope, postRender, preRender, setLocation, setLocation |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public Macro()
| Method Detail |
|---|
public String getName()
getName in class Directivepublic int getType()
getType in class Directivepublic boolean isScopeProvided()
isScopeProvided in class Directive
public boolean render(InternalContextAdapter context,
Writer writer,
Node node)
throws IOException
render in class Directivecontext - writer - node -
IOException
public void init(RuntimeServices rs,
InternalContextAdapter context,
Node node)
throws TemplateInitException
Directive
init in class DirectiveTemplateInitExceptionDirective.init(org.apache.velocity.runtime.RuntimeServices, org.apache.velocity.context.InternalContextAdapter, org.apache.velocity.runtime.parser.node.Node)
public 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.
ParseException
public static final StringBuffer macroToString(StringBuffer buf,
List<Macro.MacroArg> macroArgs)
argArray and appends them to buf.
buf - A StringBuffer. If null, a new StringBuffer is allocated.macroArgs - Array of macro arguments, containing the
#macro() arguments and default values. the 0th is the name.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||