org.apache.velocity.runtime.directive
Class VelocimacroProxy
public
class
VelocimacroProxy
extends Directive
VelocimacroProxy.java
a proxy Directive-derived object to fit with the current directive system
Version: $Id: VelocimacroProxy.java,v 1.27.4.1 2004/03/03 23:22:56 geirm Exp $
Author: Geir Magnusson Jr.
Method Summary |
String[] | getArgArray(Node node)
gets the args to the VM from the instance-use AST |
String | getName()
Return name of this Velocimacro. |
int | getNumArgs()
returns the number of ars needed for this VM |
int | getType()
Velocimacros are always LINE
type directives. |
void | init(RuntimeServices rs, InternalContextAdapter context, Node node)
The major meat of VelocimacroProxy, init() checks the # of arguments, patches the
macro body, renders the macro into an AST, and then inits the AST, so it is ready
for quick rendering. |
void | parseTree(String[] callArgs)
parses the macro. |
boolean | render(InternalContextAdapter context, Writer writer, Node node)
Renders the macro using the context |
void | setArgArray(String[] arr)
sets the array of arguments specified in the macro definition |
void | setMacrobody(String mb)
Sets the orignal macro body. |
void | setName(String name)
sets the directive name of this VM |
void | setNamespace(String ns) |
void | setNodeTree(SimpleNode tree) |
boolean | setupMacro(String[] callArgs, int[] callArgTypes)
basic VM setup. |
void | setupProxyArgs(String[] callArgs, int[] callArgTypes) |
private String[] argArray
private String[] callingArgs
private int[] callingArgTypes
private boolean init
private String macroBody
private String macroName
private String namespace
private int numMacroArgs
private HashMap proxyArgHash
private String[] getArgArray(
Node node)
gets the args to the VM from the instance-use AST
public String getName()
Return name of this Velocimacro.
public int getNumArgs()
returns the number of ars needed for this VM
public int getType()
Velocimacros are always LINE
type directives.
The major meat of VelocimacroProxy, init() checks the # of arguments, patches the
macro body, renders the macro into an AST, and then inits the AST, so it is ready
for quick rendering. Note that this is only AST dependant stuff. Not context.
private void parseTree(String[] callArgs)
parses the macro. We need to do this here, at init time, or else
the local-scope template feature is hard to get to work :)
Renders the macro using the context
public void setArgArray(String[] arr)
sets the array of arguments specified in the macro definition
public void setMacrobody(String mb)
Sets the orignal macro body. This is simply the cat of the macroArray, but the
Macro object creates this once during parsing, and everyone shares it.
Note : it must not be modified.
public void setName(String name)
sets the directive name of this VM
public void setNamespace(String ns)
public boolean setupMacro(String[] callArgs, int[] callArgTypes)
basic VM setup. Sets up the proxy args for this
use, and parses the tree
private void setupProxyArgs(String[] callArgs, int[] callArgTypes)
Copyright B) 2002 Apache Software Foundation. All Rights Reserved.