ee.mare.indrek.jtlt
Class TemplateGenerator

Object
  extended byee.mare.indrek.jtlt.TemplateGenerator
All Implemented Interfaces:
TemplateParams
Direct Known Subclasses:
HtmlTemplateGenerator

public class TemplateGenerator
extends Object
implements TemplateParams

Class for generating instances of templates from one template file. This class represents the parsed template structure that can be used by multiple Template classes. The class implements TemplateParams and passes itself to parsetime macros at parse time.


Constructor Summary
TemplateGenerator(Reader in)
          Construct a TemplateGenerator from Reader 'in' using the default TemplateContext.
TemplateGenerator(Reader in, TemplateContext ctx)
          Construct a TemplateGenerator from Reader 'in' and associated with context.
TemplateGenerator(String path)
          Construct a TemplateGenerator from path using the default TemplateContext.
TemplateGenerator(String path, TemplateContext ctx)
          Construct a TemplateGenerator from path using given TemplateContext.
 
Method Summary
 Template createTemplate()
          Create a new template instance from this template generator.
 Object findParam(String ident, boolean search_parent)
          Query for a macro parameter, the scope of parameters is at the block where the macro is found.
 TemplateContext getTemplateContext()
          Return the template context object.
 
Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TemplateGenerator

public TemplateGenerator(Reader in)
                  throws IOException,
                         TemplateException
Construct a TemplateGenerator from Reader 'in' using the default TemplateContext.


TemplateGenerator

public TemplateGenerator(Reader in,
                         TemplateContext ctx)
                  throws IOException,
                         TemplateException
Construct a TemplateGenerator from Reader 'in' and associated with context.


TemplateGenerator

public TemplateGenerator(String path)
                  throws IOException,
                         TemplateException
Construct a TemplateGenerator from path using the default TemplateContext.


TemplateGenerator

public TemplateGenerator(String path,
                         TemplateContext ctx)
                  throws IOException,
                         TemplateException
Construct a TemplateGenerator from path using given TemplateContext.

Method Detail

createTemplate

public Template createTemplate()
Create a new template instance from this template generator.


findParam

public Object findParam(String ident,
                        boolean search_parent)
Description copied from interface: TemplateParams
Query for a macro parameter, the scope of parameters is at the block where the macro is found.

Specified by:
findParam in interface TemplateParams
Parameters:
search_parent - whether to recursively search the parent blocks for the parameter
See Also:
TemplateMacro

getTemplateContext

public TemplateContext getTemplateContext()
Description copied from interface: TemplateParams
Return the template context object.

Specified by:
getTemplateContext in interface TemplateParams