Interface IElEvaluator


public interface IElEvaluator
Evaluator for EL expression. This is concerned only with evaluation and explicitly does not allow modifying the context such as available utility methods or registered EL resolvers. This allows for better caching, so that an evaluator can be created once and reused for multiple evaluations. Each evaluation runs with the same configuration, but allows specifying a different set of variables for each evaluation.
Since:
8.5.0
  • Method Summary

    Modifier and Type
    Method
    Description
    evaluate(String expression)
    Evaluates an EL expression and returns the result.
    evaluate(String expression, IElTopLevelResolver varResolver)
    Evaluates an EL expression, with variables of the given resolver available in the top-level scope, and returns the result.
    <T> T
    evaluate(String expression, Class<T> expectedType)
    Evaluates an EL expression, coerces the result to the given type, and returns the result.
    <T> T
    evaluate(String expression, Class<T> expectedType, IElTopLevelResolver varResolver)
    Evaluates an EL expression, with variables of the given resolver available in the top-level scope, coerces the result to the given type, and returns the result.
    <T> T
    evaluate(String expression, Class<T> expectedType, Map<String,?> vars)
    Evaluates an EL expression, with variables of the given map available in the top-level scope, coerces the result to the given type, and returns the result.
    evaluate(String expression, Map<String,?> vars)
    Evaluates an EL expression, with variables of the given map available in the top-level scope, and returns the result.
  • Method Details

    • evaluate

      Object evaluate(String expression)
      Evaluates an EL expression and returns the result.
      Parameters:
      expression - The EL expression to evaluate.
      Returns:
      The result of the evaluation.
    • evaluate

      Object evaluate(String expression, Map<String,?> vars)
      Evaluates an EL expression, with variables of the given map available in the top-level scope, and returns the result.
      Parameters:
      expression - The EL expression to evaluate.
      vars - The map of variables that should be available during the evaluation.
      Returns:
      The result of the evaluation.
    • evaluate

      Object evaluate(String expression, IElTopLevelResolver varResolver)
      Evaluates an EL expression, with variables of the given resolver available in the top-level scope, and returns the result.
      Parameters:
      expression - The EL expression to evaluate.
      varResolver - The variable resolver that provides the top-level variables that should be available during the evaluation.
      Returns:
      The result of the evaluation.
    • evaluate

      <T> T evaluate(String expression, Class<T> expectedType)
      Evaluates an EL expression, coerces the result to the given type, and returns the result.
      Type Parameters:
      T - The expected type of the result.
      Parameters:
      expression - The EL expression to evaluate.
      expectedType - The type to which the result should be coerced.
      Returns:
      The result of the evaluation, coerced to the expected type.
    • evaluate

      <T> T evaluate(String expression, Class<T> expectedType, Map<String,?> vars)
      Evaluates an EL expression, with variables of the given map available in the top-level scope, coerces the result to the given type, and returns the result.
      Type Parameters:
      T - The expected type of the result.
      Parameters:
      expression - The EL expression to evaluate.
      expectedType - The type to which the result should be coerced.
      vars - The map of variables that should be available during the evaluation.
      Returns:
      The result of the evaluation, coerced to the expected type.
    • evaluate

      <T> T evaluate(String expression, Class<T> expectedType, IElTopLevelResolver varResolver)
      Evaluates an EL expression, with variables of the given resolver available in the top-level scope, coerces the result to the given type, and returns the result.
      Type Parameters:
      T - The expected type of the result.
      Parameters:
      expression - The EL expression to evaluate.
      expectedType - The type to which the result should be coerced.
      varResolver - The variable resolver that provides the top-level variables that should be available during the evaluation.
      Returns:
      The result of the evaluation, coerced to the expected type.