Package org.smooks.engine.expression
Class MVELExpressionEvaluator
- java.lang.Object
-
- org.smooks.engine.expression.MVELExpressionEvaluator
-
- All Implemented Interfaces:
ExpressionEvaluator
public class MVELExpressionEvaluator extends Object implements ExpressionEvaluator
MVEL expression evaluator.- Author:
- tom.fennelly@gmail.com, maurice@zeijen.net
-
-
Constructor Summary
Constructors Constructor Description MVELExpressionEvaluator()
MVELExpressionEvaluator(String expression)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
eval(Object contextObject)
Evaluate a conditional expression against the supplied object (can be a Map).Object
exec(Object contextObject)
Object
exec(Object contextObject, Map<String,Object> variableMap)
Serializable
getCompiled()
String
getExpression()
Get the String representation of the active expression on the evaluator instance.Object
getValue(Object contextObject)
Evaluate an expression against the supplied Map variable, returning the eval result.ExpressionEvaluator
setExpression(String expression)
Set the condition expression for the evaluator implementation.void
setToType(Class<?> toType)
String
toString()
-
-
-
Constructor Detail
-
MVELExpressionEvaluator
public MVELExpressionEvaluator()
-
MVELExpressionEvaluator
public MVELExpressionEvaluator(String expression)
-
-
Method Detail
-
setExpression
public ExpressionEvaluator setExpression(String expression) throws SmooksConfigException
Description copied from interface:ExpressionEvaluator
Set the condition expression for the evaluator implementation.- Specified by:
setExpression
in interfaceExpressionEvaluator
- Parameters:
expression
- The expression to be evaluated by the evaluator implementation.- Throws:
SmooksConfigException
- Invalid expression configuration.
-
getExpression
public String getExpression()
Description copied from interface:ExpressionEvaluator
Get the String representation of the active expression on the evaluator instance.- Specified by:
getExpression
in interfaceExpressionEvaluator
- Returns:
- The active expression String representation.
-
setToType
public void setToType(Class<?> toType)
-
eval
public boolean eval(Object contextObject) throws ExpressionEvaluationException
Description copied from interface:ExpressionEvaluator
Evaluate a conditional expression against the supplied object (can be a Map).- Specified by:
eval
in interfaceExpressionEvaluator
- Parameters:
contextObject
- The object against which the expression is to be evaluated.- Returns:
- True if the expression evaluates to true, otherwise false.
- Throws:
ExpressionEvaluationException
- Invalid expression evaluation condition (implementation specific).
-
exec
public Object exec(Object contextObject, Map<String,Object> variableMap) throws ExpressionEvaluationException
- Throws:
ExpressionEvaluationException
-
exec
public Object exec(Object contextObject) throws ExpressionEvaluationException
- Throws:
ExpressionEvaluationException
-
getValue
public Object getValue(Object contextObject) throws ExpressionEvaluationException
Description copied from interface:ExpressionEvaluator
Evaluate an expression against the supplied Map variable, returning the eval result.- Specified by:
getValue
in interfaceExpressionEvaluator
- Returns:
- Expression evaluation result.
- Throws:
ExpressionEvaluationException
- Invalid expression evaluation (implementation specific).
-
getCompiled
public Serializable getCompiled()
- Returns:
- the compiled
-
-