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$
- Author:
- Geir Magnusson Jr.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionboolean
addVelocimacro
(String name, Node macroBody, List<Macro.MacroArg> macroArgs, Template definingTemplate) Adds a macro to the factory.getVelocimacro
(String vmName, Template renderingTemplate, Template sourceTemplate) actual factory: creates a Directive that will behave correctly wrt getting the framework to dig out the correct # of argsvoid
initialize the factory - setup all permissions load all global libraries.boolean
isVelocimacro
(String vm, Template template) 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, Node macroBody, List<Macro.MacroArg> macroArgs, Template definingTemplate) Adds a macro to the factory.- Parameters:
name
- Name of the Macro to add.macroBody
- root node of the parsed macro ASTmacroArgs
- Array of macro arguments, containing the #macro() arguments and default values. the 0th is the name.definingTemplate
- template containing the macro definition- 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.template
- 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.renderingTemplate
- destination templatesourceTemplate
- Source template from which the macro should be loaded.- Returns:
- A directive representing the Macro.
-