| java.lang.Object org.apache.velocity.runtime.directive.Directive org.apache.velocity.runtime.directive.Macro
Macro | public class Macro extends Directive (Code) | | 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.
author: Geir Magnusson Jr. author: Henning P. Schmiedehausen version: $Id: Macro.java 471881 2006-11-06 21:21:10Z henning $ |
getName | public String getName()(Code) | | Return name of this directive.
The name of this directive. |
getType | public int getType()(Code) | | Return type of this directive.
The type of this directive. |
macroToString | final public static StringBuffer macroToString(StringBuffer buf, String[] argArray)(Code) | | For debugging purposes. Formats the arguments from
argArray and appends them to buf .
Parameters: buf - A StringBuffer. If null, a new StringBuffer is allocated. Parameters: argArray - The Macro arguments to format A StringBuffer containing the formatted arguments. If a StringBufferhas passed in as buf, this method returns it. |
processAndRegister | public static void processAndRegister(RuntimeServices rs, Token t, Node node, String sourceTemplate) throws IOException, ParseException(Code) | | 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.
Parameters: rs - Parameters: t - Parameters: node - Parameters: sourceTemplate - throws: IOException - throws: ParseException - |
render | public boolean render(InternalContextAdapter context, Writer writer, Node node) throws IOException(Code) | | render() doesn't do anything in the final output rendering.
There is no output from a #macro() directive.
Parameters: context - Parameters: writer - Parameters: node - True if the directive rendered successfully. throws: IOException - |
|
|