ee.mare.indrek.jtlt.macros
Class SepMacro

Object
  extended byee.mare.indrek.jtlt.macros.MacroAdapter
      extended byee.mare.indrek.jtlt.macros.SepMacro
All Implemented Interfaces:
TemplateMacro

public class SepMacro
extends MacroAdapter

A macro for producing separators, like commas, for easier list creation.


Constructor Summary
SepMacro(String macro_name, String default_name, String separator)
          SepMacro returns a SUB with contents of separator inside it.
 
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 params, 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 ee.mare.indrek.jtlt.macros.MacroAdapter
getName
 
Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SepMacro

public SepMacro(String macro_name,
                String default_name,
                String separator)
SepMacro returns a SUB with contents of separator inside it. The sub will be named as macro argument or if no argument given then as default_name.

Method Detail

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 params,
                      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