Save This Page
Home » velocity-1.5 » org.apache » velocity » runtime » directive » [javadoc | source]
org.apache.velocity.runtime.directive
public class: Macro [javadoc | source]
java.lang.Object
   org.apache.velocity.runtime.directive.Directive
      org.apache.velocity.runtime.directive.Macro

All Implemented Interfaces:
    Cloneable, DirectiveConstants

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.
Fields inherited from org.apache.velocity.runtime.directive.Directive:
rsvc
Method from org.apache.velocity.runtime.directive.Macro Summary:
getName,   getType,   init,   macroToString,   processAndRegister,   render
Methods from org.apache.velocity.runtime.directive.Directive:
getColumn,   getLine,   getName,   getType,   init,   render,   setLocation
Methods from java.lang.Object:
equals,   getClass,   hashCode,   notify,   notifyAll,   toString,   wait,   wait,   wait
Method from org.apache.velocity.runtime.directive.Macro Detail:
 public String getName() 
    Return name of this directive.
 public int getType() 
    Return type of this directive.
 public  void init(RuntimeServices rs,
    InternalContextAdapter context,
    Node node) throws TemplateInitException 
 public static final StringBuffer macroToString(StringBuffer buf,
    String[] argArray) 
    For debugging purposes. Formats the arguments from argArray and appends them to buf.
 public static  void processAndRegister(RuntimeServices rs,
    Token t,
    Node node,
    String sourceTemplate) throws IOException, ParseException 
    Used by Parser.java to process VMs during the parsing process. This method does not render the macro to the output stream, but rather processes the macro body into the internal representation used by {#link org.apache.velocity.runtime.directive.VelocimacroProxy} objects, and if not currently used, adds it to the macro Factory.
 public boolean render(InternalContextAdapter context,
    Writer writer,
    Node node) throws IOException 
    render() doesn't do anything in the final output rendering. There is no output from a #macro() directive.