Package org.apache.velocity.runtime
Class VelocimacroFactory
java.lang.Object
org.apache.velocity.runtime.VelocimacroFactory
VelocimacroFactory.java
manages the set of VMs in a running Velocity engine.
- Version:
- $Id: VelocimacroFactory.java 894953 2009-12-31 22:48:19Z nbubna $
- Author:
- Geir Magnusson Jr.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanaddVelocimacro(String name, String macroBody, String[] argArray, String sourceTemplate) Adds a macro to the factory.booleanaddVelocimacro(String name, Node macroBody, String[] argArray, String sourceTemplate) Adds a macro to the factory.booleandumpVMNamespace(String namespace) tells the vmManager to dump the specified namespacegetVelocimacro(String vmName, String sourceTemplate) actual factory : creates a Directive that will behave correctly wrt getting the framework to dig out the correct # of argsgetVelocimacro(String vmName, String sourceTemplate, String renderingTemplate) voidinitialize the factory - setup all permissions load all global libraries.booleanisVelocimacro(String vm, String sourceTemplate) Tells the world if a given directive string is a Velocimacro
-
Constructor Details
-
VelocimacroFactory
C'tor for the VelociMacro factory.- Parameters:
rsvc- Reference to a runtime services object.
-
-
Method Details
-
initVelocimacro
public void initVelocimacro()initialize the factory - setup all permissions load all global libraries. -
addVelocimacro
public boolean addVelocimacro(String name, String macroBody, String[] argArray, String sourceTemplate) Adds a macro to the factory. addVelocimacro(String, Node, String[] argArray, String) should be used internally instead of this.- Parameters:
name- Name of the Macro to add.macroBody- String representation of the macro.argArray- Macro arguments. First element is the macro name.sourceTemplate- Source template from which the macro gets registered.- Returns:
- true if Macro was registered successfully.
-
addVelocimacro
public boolean addVelocimacro(String name, Node macroBody, String[] argArray, String sourceTemplate) Adds a macro to the factory.- Parameters:
name- Name of the Macro to add.macroBody- root node of the parsed macro ASTargArray- Name of the macro arguments. First element is the macro name.sourceTemplate- Source template from which the macro gets registered.- Returns:
- true if Macro was registered successfully.
- Since:
- 1.6
-
isVelocimacro
Tells the world if a given directive string is a Velocimacro- Parameters:
vm- Name of the Macro.sourceTemplate- Source template from which the macro should be loaded.- Returns:
- True if the given name is a macro.
-
getVelocimacro
actual factory : creates a Directive that will behave correctly wrt getting the framework to dig out the correct # of args- Parameters:
vmName- Name of the Macro.sourceTemplate- Source template from which the macro should be loaded.- Returns:
- A directive representing the Macro.
-
getVelocimacro
- Since:
- 1.6
-
dumpVMNamespace
tells the vmManager to dump the specified namespace- Parameters:
namespace- Namespace to dump.- Returns:
- True if namespace has been dumped successfully.
-