org.apache.velocity.runtime.directive

Class Macro

public class Macro extends Directive

Macro.java 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.

Version: $Id: Macro.java,v 1.16.4.1 2004/03/03 23:22:56 geirm Exp $

Author: Geir Magnusson Jr.

Field Summary
static booleandebugMode
Method Summary
static String[]getArgArray(Node node)
creates an array containing the literal strings in the macro arguement
static ListgetASTAsStringArray(Node rootNode)
Returns an array of the literal rep of the AST
StringgetName()
Return name of this directive.
intgetType()
Return type of this directive.
voidinit(RuntimeServices rs, InternalContextAdapter context, Node node)
static voidprocessAndRegister(RuntimeServices rs, Node node, String sourceTemplate)
Used by Parser.java to process VMs withing the parsing process processAndRegister() doesn't actually render the macro to the output Processes the macro body into the internal representation used by the VelocimacroProxy objects, and if not currently used, adds it to the macro Factory
booleanrender(InternalContextAdapter context, Writer writer, Node node)
render() doesn't do anything in the final output rendering.

Field Detail

debugMode

private static boolean debugMode

Method Detail

getArgArray

private static String[] getArgArray(Node node)
creates an array containing the literal strings in the macro arguement

getASTAsStringArray

private static List getASTAsStringArray(Node rootNode)
Returns an array of the literal rep of the AST

getName

public String getName()
Return name of this directive.

getType

public int getType()
Return type of this directive.

init

public void init(RuntimeServices rs, InternalContextAdapter context, Node node)

processAndRegister

public static void processAndRegister(RuntimeServices rs, Node node, String sourceTemplate)
Used by Parser.java to process VMs withing the parsing process processAndRegister() doesn't actually render the macro to the output Processes the macro body into the internal representation used by the VelocimacroProxy objects, and if not currently used, adds it to the macro Factory

render

public boolean render(InternalContextAdapter context, Writer writer, Node node)
render() doesn't do anything in the final output rendering. There is no output from a #macro() directive.
Copyright B) 2002 Apache Software Foundation. All Rights Reserved.