Interface Expression

All Known Implementing Classes:
AbstractGetValueExpression, BeanWrapperExpression, CollectionAddingExpression, CompositeStringExpression, ELExpression, LiteralExpression, SpringELExpression, StaticExpression

public interface Expression
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 independent of any language like Spring EL or the Unified EL.
Author:
Keith Donald
  • Method Summary

    Modifier and Type
    Method
    Description
    Returns the original string used to create this expression, unmodified.
    getValue(Object context)
    Evaluate this expression in the provided context and return the result of evaluation.
    Returns the most general type that can be passed to the setValue(Object, Object) method for the given context.
    void
    setValue(Object context, Object value)
    Set this expression in the provided context to the value provided.
  • Method Details

    • getValue

      Object getValue(Object context) throws EvaluationException
      Evaluate this expression in the provided context and return the result of evaluation.
      Parameters:
      context - the context to evaluate this expression in
      Returns:
      the evaluation result
      Throws:
      EvaluationException - an exception occurred during expression evaluation
    • setValue

      void setValue(Object context, Object value) throws EvaluationException
      Set this expression in the provided context to the value provided.
      Parameters:
      context - the context on which the new value should be set
      value - the new value to set
      Throws:
      EvaluationException - an exception occurred during expression evaluation
    • getValueType

      Class<?> getValueType(Object context) throws EvaluationException
      Returns the most general type that can be passed to the setValue(Object, Object) method for the given context.
      Parameters:
      context - the context to evaluate
      Returns:
      the most general type of value that can be set on this context, or null if the type information cannot be determined
      Throws:
      EvaluationException - an exception occurred during expression evaluation
    • getExpressionString

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