Interface ValueExpression


public interface ValueExpression
An expression capable of evaluating itself against context objects. Encapsulates the details of a previously parsed expression string. Provides a common abstraction for expression evaluation.
Since:
3.3
Author:
Christoph Strobl, Mark Paluch
  • Method Details

    • getExpressionString

      String getExpressionString()
      Returns the original string used to create this expression (unmodified).
      Returns:
      the original expression string.
    • getExpressionDependencies

      default ExpressionDependencies getExpressionDependencies()
      Returns the expression dependencies.
      Returns:
      the dependencies the underlying expression requires. Can be ExpressionDependencies.none().
    • isLiteral

      boolean isLiteral()
      Returns whether the expression is a literal expression (that doesn't actually require evaluation).
      Returns:
      true if the expression is a literal expression; false if the expression can yield a different result upon evaluation.
    • evaluate

      Evaluates this expression using the given evaluation context.
      Returns:
      the evaluation result.
      Throws:
      EvaluationException - if there is a problem during evaluation
    • getValueType

      @Nullable Class<?> getValueType(ValueEvaluationContext context) throws EvaluationException
      Return the most general type that the expression would use as return type for the given context.
      Parameters:
      context - the context in which to evaluate the expression.
      Returns:
      the most general type of value.
      Throws:
      EvaluationException - if there is a problem determining the type
      Since:
      3.4