org.ujac.util.template
Interface TemplateInterpreter

All Known Implementing Classes:
BaseTemplateInterpreter, DefaultTemplateInterpreter

public interface TemplateInterpreter

Name: TemplateInterpreter
Description: Description of the class.

Author:
lauerc

Method Summary
 boolean evalBooleanExpr(String expression, TemplateContext ctx)
          Evaluates an expression as a boolean value.
 Date evalDateExpr(String expression, TemplateContext ctx)
          Evaluates an expression as a Date value.
 double evalDoubleExpr(String expression, TemplateContext ctx)
          Evaluates an expression as a double value.
 float evalFloatExpr(String expression, TemplateContext ctx)
          Evaluates an expression as a float value.
 int evalIntExpr(String expression, TemplateContext ctx)
          Evaluates an expression as an int value.
 long evalLongExpr(String expression, TemplateContext ctx)
          Evaluates an expression as a long value.
 Object evalObjectExpr(String expression, TemplateContext ctx)
          Evaluates an expression as an Object.
 String evalStringExpr(String expression, TemplateContext ctx)
          Evaluates an expression as a String value.
 Time evalTimeExpr(String expression, TemplateContext ctx)
          Evaluates an expression as a Time value.
 Timestamp evalTimestampExpr(String expression, TemplateContext ctx)
          Evaluates an expression as a Timestamp value.
 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.
 ExpressionFilter getExpressionFilter()
          Getter method for the the property expressionFilter.
 TemplateRoot parse(String source)
          Parses the given template source code.
 void setExpressionFilter(ExpressionFilter expressionFilter)
          Setter method for the the property expressionFilter.
 

Method Detail

parse

TemplateRoot parse(String 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.

execute

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

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

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

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

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

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.

evalBooleanExpr

boolean evalBooleanExpr(String expression,
                        TemplateContext ctx)
                        throws ExpressionException
Evaluates an expression as a boolean value.

Parameters:
expression - The expression to evaluate.
ctx - The template context.
Returns:
The evaluated boolean.
Throws:
ExpressionException - If the expression could not be successfuly resolved

evalIntExpr

int evalIntExpr(String expression,
                TemplateContext ctx)
                throws ExpressionException
Evaluates an expression as an int value.

Parameters:
expression - The expression to evaluate.
ctx - The template context.
Returns:
The evaluated boolean.
Throws:
ExpressionException - If the expression could not be successfuly resolved

evalLongExpr

long evalLongExpr(String expression,
                  TemplateContext ctx)
                  throws ExpressionException
Evaluates an expression as a long value.

Parameters:
expression - The expression to evaluate.
ctx - The template context.
Returns:
The evaluated boolean.
Throws:
ExpressionException - If the expression could not be successfuly resolved

evalFloatExpr

float evalFloatExpr(String expression,
                    TemplateContext ctx)
                    throws ExpressionException
Evaluates an expression as a float value.

Parameters:
expression - The expression to evaluate.
ctx - The template context.
Returns:
The evaluated boolean.
Throws:
ExpressionException - If the expression could not be successfuly resolved

evalDoubleExpr

double evalDoubleExpr(String expression,
                      TemplateContext ctx)
                      throws ExpressionException
Evaluates an expression as a double value.

Parameters:
expression - The expression to evaluate.
ctx - The template context.
Returns:
The evaluated boolean.
Throws:
ExpressionException - If the expression could not be successfuly resolved

evalDateExpr

Date evalDateExpr(String expression,
                  TemplateContext ctx)
                  throws ExpressionException
Evaluates an expression as a Date value.

Parameters:
expression - The expression to evaluate.
ctx - The template context.
Returns:
The evaluated boolean.
Throws:
ExpressionException - If the expression could not be successfuly resolved

evalTimeExpr

Time evalTimeExpr(String expression,
                  TemplateContext ctx)
                  throws ExpressionException
Evaluates an expression as a Time value.

Parameters:
expression - The expression to evaluate.
ctx - The template context.
Returns:
The evaluated boolean.
Throws:
ExpressionException - If the expression could not be successfuly resolved

evalTimestampExpr

Timestamp evalTimestampExpr(String expression,
                            TemplateContext ctx)
                            throws ExpressionException
Evaluates an expression as a Timestamp value.

Parameters:
expression - The expression to evaluate.
ctx - The template context.
Returns:
The evaluated boolean.
Throws:
ExpressionException - If the expression could not be successfuly resolved

evalStringExpr

String evalStringExpr(String expression,
                      TemplateContext ctx)
                      throws ExpressionException
Evaluates an expression as a String value.

Parameters:
expression - The expression to evaluate.
ctx - The template context.
Returns:
The evaluated boolean.
Throws:
ExpressionException - If the expression could not be successfuly resolved

evalObjectExpr

Object evalObjectExpr(String expression,
                      TemplateContext ctx)
                      throws ExpressionException
Evaluates an expression as an Object.

Parameters:
expression - The expression to evaluate.
ctx - The template context.
Returns:
The evaluated object.
Throws:
ExpressionException - If the expression could not be successfuly resolved

getExpressionFilter

ExpressionFilter getExpressionFilter()
Getter method for the the property expressionFilter.

Returns:
The current value of property expressionFilter.

setExpressionFilter

void setExpressionFilter(ExpressionFilter expressionFilter)
Setter method for the the property expressionFilter.

Parameters:
expressionFilter - The value to set for the property expressionFilter.


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