Package org.zkoss.zk.xel.impl
Class SimpleEvaluator
- java.lang.Object
-
- 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 ofEvaluator
.- Since:
- 3.0.0
- Author:
- tomyeh
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description SimpleEvaluator(FunctionMapper mapper, java.lang.Class<? extends ExpressionFactory> expfcls)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description 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.
-
-
-
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 interfaceEvaluator
- 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 interfaceEvaluator
- 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 interfaceEvaluator
- 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<? extends org.zkoss.xel.ExpressionFactory>)
.- Parameters:
ref
- the object,either page, component, or null. It is passed toevaluate(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 toevaluate(org.zkoss.zk.ui.Page, org.zkoss.xel.Expression)
-
-