org.ujac.util.template
Class DefaultTemplateInterpreter

java.lang.Object
  extended by org.ujac.util.template.BaseTemplateInterpreter
      extended by org.ujac.util.template.DefaultTemplateInterpreter
All Implemented Interfaces:
TemplateInterpreter

public class DefaultTemplateInterpreter
extends BaseTemplateInterpreter

Name: DefaultTemplateInterpreter
Description: Default TemplateInterpreter implementation.

Author:
lauerc

Field Summary
 
Fields inherited from class org.ujac.util.template.BaseTemplateInterpreter
exi, expressionFilter, tokenTypes
 
Constructor Summary
DefaultTemplateInterpreter()
          Constructs a TemplateInterpreter instance with specific attributes.
DefaultTemplateInterpreter(ExpressionInterpreter exi)
          Constructs a TemplateInterpreter instance with specific attributes.
 
Method Summary
 Object clone()
           
 String execute(String template, TemplateContext ctx)
          Executes the given template.
 void execute(String template, Writer writer, TemplateContext ctx)
          Executes the given template.
 void execute(TemplateRoot template, Writer writer, TemplateContext ctx)
          Executes the given template.
 TemplateRoot parse(char[] source)
          Parses the given template source code.
 TemplateRoot parse(String source)
          Parses the given template source code.
 int parse(TemplateTokenContainer tokenContainer)
          Parses the given template token.
 
Methods inherited from class org.ujac.util.template.BaseTemplateInterpreter
createToken, evalBooleanExpr, evalBooleanExpr, evalDateExpr, evalDateExpr, evalDoubleExpr, evalDoubleExpr, evalFloatExpr, evalFloatExpr, evalIntExpr, evalIntExpr, evalLongExpr, evalLongExpr, evalObjectExpr, evalObjectExpr, evalStringExpr, evalStringExpr, evalTimeExpr, evalTimeExpr, evalTimestampExpr, evalTimestampExpr, getExpressionFilter, getTokenType, parse, parseExpr, parseExpr, registerTokenTypes, setExpressionFilter
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultTemplateInterpreter

public DefaultTemplateInterpreter()
Constructs a TemplateInterpreter instance with specific attributes.


DefaultTemplateInterpreter

public DefaultTemplateInterpreter(ExpressionInterpreter exi)
Constructs a TemplateInterpreter instance with specific attributes.

Parameters:
exi - The expression interpreter to use.
Method Detail

parse

public TemplateRoot parse(String source)
                   throws TemplateException,
                          IOException
Parses the given template source code.

Specified by:
parse in interface TemplateInterpreter
Overrides:
parse in class BaseTemplateInterpreter
Parameters:
source - The source to parse.
Returns:
The parsed statement.
Throws:
TemplateException - If the expression could not be successfuly resolved
IOException - In case a I/O problem occured while writing the expression result.

parse

public TemplateRoot parse(char[] source)
                   throws TemplateException,
                          IOException
Parses the given template source code.

Parameters:
source - The source to parse.
Returns:
The parsed statement.
Throws:
TemplateException - If the expression could not be successfuly resolved
IOException - In case a I/O problem occured while writing the expression result.

parse

public int parse(TemplateTokenContainer tokenContainer)
          throws TemplateException,
                 IOException
Parses the given template token.

Specified by:
parse in class BaseTemplateInterpreter
Parameters:
tokenContainer - The token container to fill.
Returns:
The continue position for the next parse step.
Throws:
TemplateException - If the expression could not be successfuly resolved
IOException - In case a I/O problem occured while writing the expression result.

execute

public String execute(String template,
                      TemplateContext ctx)
               throws TemplateException
Executes the given template.

Specified by:
execute in interface TemplateInterpreter
Overrides:
execute in class BaseTemplateInterpreter
Parameters:
template - The source code of the template to execute.
ctx - The template context to use.
Returns:
The template execution result.
Throws:
TemplateException - If the an expression could not be successfuly resolved

execute

public void execute(String template,
                    Writer writer,
                    TemplateContext ctx)
             throws TemplateException,
                    IOException
Executes the given template.

Specified by:
execute in interface TemplateInterpreter
Overrides:
execute in class BaseTemplateInterpreter
Parameters:
template - The source code of the template to execute.
writer - The writer to output the result to.
ctx - The template context to use.
Throws:
TemplateException - If the an expression could not be successfuly resolved
IOException - If something went wrong while writing the result to the given writer.

execute

public void execute(TemplateRoot template,
                    Writer writer,
                    TemplateContext ctx)
             throws TemplateException,
                    IOException
Executes the given template.

Specified by:
execute in interface TemplateInterpreter
Overrides:
execute in class BaseTemplateInterpreter
Parameters:
template - The root element of the template parse result.
writer - The writer to output the result to.
ctx - The template context to use.
Throws:
TemplateException - If the an expression could not be successfuly resolved
IOException - If something went wrong while writing the result to the given writer.

clone

public Object clone()
Overrides:
clone in class Object
See Also:
Object.clone()


Copyright © 2003-2004 UJAC.org. All Rights Reserved.