ee.mare.indrek.jtlt.macros
Class AliasMacro
Object
ee.mare.indrek.jtlt.macros.MacroAdapter
ee.mare.indrek.jtlt.macros.AliasMacro
- All Implemented Interfaces:
- TemplateMacro
- public class AliasMacro
- extends MacroAdapter
A macro (ALIAS) for accessing the alias database. Uses Map named
as "alias_db_all" in the params. This points to the "all" map
inside aliases database. This macro is recursive non-parsetime.
Method Summary |
boolean |
isParsetime()
Returns whether a macro is parsetime or not. |
boolean |
isRecursive()
Whether to recursively parse the output of this the macro. |
String |
process(TemplateParams ctx,
String name,
String args)
This method is called with given block context whenever a macro
with registered name is found inside the tempalate. |
Methods inherited from class Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
AliasMacro
public AliasMacro()
AliasMacro
public AliasMacro(String name)
isParsetime
public boolean isParsetime()
- Description copied from interface:
TemplateMacro
- Returns whether a macro is parsetime or not. Being parsetime means here
that the macro does not depend on template instance specified
parameters and can be resolved at parsing time. But resolving macros
only at parsetime is faster than doing it on every created template.
Not all instances of macro usage may be parsed at parsetime tho.
For example when the result of recursive macro contains it.
- Specified by:
isParsetime
in interface TemplateMacro
- Overrides:
isParsetime
in class MacroAdapter
isRecursive
public boolean isRecursive()
- Description copied from interface:
TemplateMacro
- Whether to recursively parse the output of this the macro. If the macro is used
at parsetime the result can contain additional sub blocks.
- Specified by:
isRecursive
in interface TemplateMacro
- Overrides:
isRecursive
in class MacroAdapter
process
public String process(TemplateParams ctx,
String name,
String args)
- Description copied from interface:
TemplateMacro
- This method is called with given block context whenever a macro
with registered name is found inside the tempalate. The
macros are resolved immediately only if they are parsetime, otherwise
on every Template.toString the data structures are parsed and
macros expanded. If macro is parsetime the ctx is taken from the generator.
You can add parameters into the template using the Template.addParam,
for parsetime macros you'd have to extend the TemplateGenerator.
- Specified by:
process
in interface TemplateMacro
- Overrides:
process
in class MacroAdapter