public class VelocimacroManager
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
private static class |
VelocimacroManager.MacroEntry
wrapper class for holding VM information
|
Modifier and Type | Field and Description |
---|---|
private java.util.Map<java.lang.String,VelocimacroManager.MacroEntry> |
globalNamespace
reference to global namespace hash
|
private boolean |
inlineLocalMode |
private boolean |
inlineReplacesGlobal |
private java.util.Map<java.lang.String,Template> |
libraries
set of names of library templates/namespaces
|
private boolean |
namespacesOn |
private boolean |
registerFromLib |
private RuntimeServices |
rsvc |
Constructor and Description |
---|
VelocimacroManager(RuntimeServices rsvc)
Adds the global namespace to the hash.
|
Modifier and Type | Method and Description |
---|---|
boolean |
addVM(java.lang.String vmName,
Node macroBody,
java.util.List<Macro.MacroArg> macroArgs,
Template definingTemplate,
boolean canReplaceGlobalMacro)
Adds a VM definition to the cache.
|
VelocimacroProxy |
get(java.lang.String vmName,
Template renderingTemplate,
Template template)
Gets a VelocimacroProxy object by the name / source template duple.
|
java.lang.String |
getLibraryName(java.lang.String vmName,
Template template)
Return the library name for a given macro.
|
void |
setInlineReplacesGlobal(boolean is) |
void |
setNamespaceUsage(boolean namespaceOn)
public switch to let external user of manager to control namespace
usage indep of properties.
|
void |
setRegisterFromLib(boolean registerFromLib)
Should macros registered from Libraries be marked special?
|
void |
setTemplateLocalInlineVM(boolean inlineLocalMode)
Should macros from the same template be inlined?
|
private boolean |
usingNamespaces()
determines if currently using namespaces.
|
private boolean registerFromLib
private final java.util.Map<java.lang.String,VelocimacroManager.MacroEntry> globalNamespace
private final java.util.Map<java.lang.String,Template> libraries
private RuntimeServices rsvc
private boolean namespacesOn
private boolean inlineLocalMode
private boolean inlineReplacesGlobal
VelocimacroManager(RuntimeServices rsvc)
public boolean addVM(java.lang.String vmName, Node macroBody, java.util.List<Macro.MacroArg> macroArgs, Template definingTemplate, boolean canReplaceGlobalMacro)
vmName
- Name of the new VelociMacro.macroBody
- String representation of the macro body.macroArgs
- Array of macro arguments, containing the
#macro() arguments and default values. the 0th is the name.definingTemplate
- The template from which this macro has been loaded.canReplaceGlobalMacro
- whether this macro can replace a global macropublic VelocimacroProxy get(java.lang.String vmName, Template renderingTemplate, Template template)
vmName
- Name of the VelocityMacro to look up.renderingTemplate
- Template we are currently rendering.template
- Source Template.public void setNamespaceUsage(boolean namespaceOn)
namespaceOn
- True if namespaces should be used.public void setRegisterFromLib(boolean registerFromLib)
registerFromLib
- True if macros from Libs should be marked.public void setTemplateLocalInlineVM(boolean inlineLocalMode)
inlineLocalMode
- True if macros should be inlined on the same template.private boolean usingNamespaces()
public java.lang.String getLibraryName(java.lang.String vmName, Template template)
vmName
- Name of the Macro to look up.template
- Templatepublic void setInlineReplacesGlobal(boolean is)
is
-