net.sf.oval.expression
Interface ExpressionLanguage

All Known Implementing Classes:
AbstractExpressionLanguage, ExpressionLanguageBeanShellImpl, ExpressionLanguageGroovyImpl, ExpressionLanguageJavaScriptImpl, ExpressionLanguageJEXLImpl, ExpressionLanguageJRubyImpl, ExpressionLanguageMVELImpl, ExpressionLanguageOGNLImpl, ExpressionLanguageScriptEngineImpl

public interface ExpressionLanguage

Author:
Sebastian Thomschke

Method Summary
 Object evaluate(String expression, Map<String,?> values)
          Evaluates the given expression.
 boolean evaluateAsBoolean(String expression, Map<String,?> values)
          Evaluates the given expression and expects it to return a boolean.
 

Method Detail

evaluate

Object evaluate(String expression,
                Map<String,?> values)
                throws ExpressionEvaluationException
Evaluates the given expression.

Parameters:
expression - the expression to evaluate
values - context values passed to the interpreter
Returns:
the result of the expression evaluation
Throws:
ExpressionEvaluationException - in case of an invalid expression

evaluateAsBoolean

boolean evaluateAsBoolean(String expression,
                          Map<String,?> values)
                          throws ExpressionEvaluationException
Evaluates the given expression and expects it to return a boolean.
  • null is interpreted as false
  • a number with value 0 is interpreted as false
  • an empty CharSequence is interpreted as false
  • a CharSequence with value "0" is interpreted as false
  • a CharSequence with value "1" is interpreted as true
  • a CharSequence with value "false" is case-insensitively interpreted as false
  • a CharSequence with value "true" is case-insensitively interpreted as true

    Parameters:
    expression - the expression to evaluate
    values - context values passed to the interpreter
    Returns:
    the result of the expression evaluation
    Throws:
    ExpressionEvaluationException - If an error during evaluation occurs or if the return value is not a boolean value.


  • Copyright © 2005–2015 The OVal Development Team. All rights reserved.