org.zkoss.zk.xel.impl
Class SimpleEvaluator

java.lang.Object
  extended by org.zkoss.zk.xel.impl.SimpleEvaluator
All Implemented Interfaces:
java.io.Serializable, Evaluator
Direct Known Subclasses:
BindEvaluatorXImpl

public class SimpleEvaluator
extends java.lang.Object
implements Evaluator

A simple implementation of Evaluator.

Since:
3.0.0
Author:
tomyeh
See Also:
Serialized Form

Constructor Summary
SimpleEvaluator(FunctionMapper mapper, java.lang.Class<? extends ExpressionFactory> expfcls)
           
 
Method Summary
 java.lang.Object evaluate(Component comp, Expression expression)
          Evaluates the expression.
 java.lang.Object evaluate(Page page, Expression expression)
          Evaluates the expression.
protected  ExpressionFactory getExpressionFactory()
          Returns the expression factory.
 java.lang.Class<? extends ExpressionFactory> getExpressionFactoryClass()
          Returns the implementation class of the expression factory, or null to use the default.
 FunctionMapper getFunctionMapper(java.lang.Object ref)
          Returns the function mapper, or null if not available.
 VariableResolver getVariableResolver(java.lang.Object ref)
          Returns the variable resolver, or null if not available.
protected  XelContext newXelContext(java.lang.Object ref)
          Instantiate a XEL context.
 Expression parseExpression(java.lang.String expression, java.lang.Class expectedType)
          Prepares the expression.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SimpleEvaluator

public SimpleEvaluator(FunctionMapper mapper,
                       java.lang.Class<? extends ExpressionFactory> expfcls)
Parameters:
expfcls - the class that implements the expression factory. If null, the default one is used.
Method Detail

parseExpression

public Expression parseExpression(java.lang.String expression,
                                  java.lang.Class expectedType)
                           throws XelException
Description copied from interface: Evaluator
Prepares the expression.

Specified by:
parseExpression in interface Evaluator
Parameters:
expression - the expression to be prepared for being evaluated later.
expectedType - the expected type of the result of the evaluation
Throws:
XelException

evaluate

public java.lang.Object evaluate(Page page,
                                 Expression expression)
                          throws XelException
Description copied from interface: Evaluator
Evaluates the expression.

Specified by:
evaluate in interface Evaluator
Parameters:
page - the page, or null to ignore
Throws:
XelException

evaluate

public java.lang.Object evaluate(Component comp,
                                 Expression expression)
                          throws XelException
Description copied from interface: Evaluator
Evaluates the expression.

Specified by:
evaluate in interface Evaluator
Parameters:
comp - the component, or null to ignore
Throws:
XelException

getExpressionFactoryClass

public java.lang.Class<? extends ExpressionFactory> getExpressionFactoryClass()
Returns the implementation class of the expression factory, or null to use the default.


getExpressionFactory

protected ExpressionFactory getExpressionFactory()
Returns the expression factory.


newXelContext

protected XelContext newXelContext(java.lang.Object ref)
Instantiate a XEL context. Don't reuse it since it has attributes (that shall not be kept after evaluation).


getFunctionMapper

public FunctionMapper getFunctionMapper(java.lang.Object ref)
Returns the function mapper, or null if not available.

Default: returns the function mapper passed thru SimpleEvaluator(org.zkoss.xel.FunctionMapper, java.lang.Class).

Parameters:
ref - the object,either page, component, or null. It is passed to evaluate(org.zkoss.zk.ui.Page, org.zkoss.xel.Expression)

getVariableResolver

public VariableResolver getVariableResolver(java.lang.Object ref)
Returns the variable resolver, or null if not available.

Default: it returns the variable resolver of the current execution, if any. Otherwise, it returns the current RequestContext, if any. If both not available, null is returned.

Parameters:
ref - the object,either page, component, or null. It is passed to evaluate(org.zkoss.zk.ui.Page, org.zkoss.xel.Expression)


Copyright © 2005-2011 Potix Corporation. All Rights Reserved. SourceForge.net Logo