org.apache.velocity.runtime.directive
Class VelocimacroProxy
- Cloneable, DirectiveConstants
public class VelocimacroProxy
VelocimacroProxy.java
a proxy Directive-derived object to fit with the current directive system
$Id: VelocimacroProxy.java,v 1.27.4.1 2004/03/03 23:22:56 geirm Exp $
private 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.
|
private 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.
|
private void | setupProxyArgs(String[] callArgs, int[] callArgTypes)
|
argArray
private String[] argArray
callingArgTypes
private int[] callingArgTypes
callingArgs
private String[] callingArgs
macroBody
private String macroBody
macroName
private String macroName
namespace
private String namespace
numMacroArgs
private int numMacroArgs
proxyArgHash
private HashMap proxyArgHash
getArgArray
private String[] getArgArray(Node node)
gets the args to the VM from the instance-use AST
getName
public String getName()
Return name of this Velocimacro.
- getName in interface Directive
getNumArgs
public int getNumArgs()
returns the number of ars needed for this VM
getType
public int getType()
Velocimacros are always LINE
type directives.
- getType in interface Directive
init
public void init(RuntimeServices rs,
InternalContextAdapter context,
Node node)
throws Exception
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.
- init in interface Directive
parseTree
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 :)
setArgArray
public void setArgArray(String[] arr)
sets the array of arguments specified in the macro definition
setMacrobody
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.
setName
public void setName(String name)
sets the directive name of this VM
setNamespace
public void setNamespace(String ns)
setNodeTree
public void setNodeTree(SimpleNode tree)
setupMacro
public boolean setupMacro(String[] callArgs,
int[] callArgTypes)
basic VM setup. Sets up the proxy args for this
use, and parses the tree
setupProxyArgs
private void setupProxyArgs(String[] callArgs,
int[] callArgTypes)
Copyright B) 2002 Apache Software Foundation. All Rights Reserved.