Class Expressions

java.lang.Object
org.forgerock.openig.el.Expressions

public final class Expressions extends Object
Utility class for evaluating expression in some collections.
  • Method Details

    • evaluateAsync

      public static Promise<Map<String,Object>,NeverThrowsException> evaluateAsync(Map<String,Object> map, Bindings bindings)
      Evaluate a map that may contain some expressions that needs to be evaluated.
      Parameters:
      map - the map to evaluate
      bindings - the bindings used for the evaluation
      Returns:
      a promise of a new Map containing the result of the evaluation.
    • evaluateAsync

      public static Promise<List<Object>,NeverThrowsException> evaluateAsync(List<Object> list, Bindings bindings)
      Evaluate a list that may contain some Expressions that needs to be evaluated.
      Parameters:
      list - the list to evaluate
      bindings - the bindings used for the evaluation
      Returns:
      a promise of a new list containing the results of the evaluations
    • evaluateAsync

      public static Promise<Object,NeverThrowsException> evaluateAsync(Object value, Bindings bindings)
      Evaluate an Object that may contain some expressions that needs to be evaluated. The supported types of Object are : String, List and Map.
      Parameters:
      value - the String to evaluate
      bindings - the bindings used for the evaluation
      Returns:
      the result of the evaluation.
    • from

      public static Map<String,Object> from(Map<String,Object> map) throws ExpressionException
      Compile a map that may contain some values that needs to be transformed as expression.
      Parameters:
      map - the map containing potential expressions
      Returns:
      a new Map containing expressions when possible.
      Throws:
      ExpressionException - if an error occurs while compiling the expression
    • from

      public static Map<String,Object> from(Map<String,Object> map, Bindings initialBindings) throws ExpressionException
      Compile a map that may contain some values that needs to be transformed as expression.
      Parameters:
      map - the map containing potential expressions
      initialBindings - the initial bindings to use when the expression will be evaluated
      Returns:
      a new Map containing expressions when possible.
      Throws:
      ExpressionException - if an error occurs while compiling the expression
    • from

      public static List<Object> from(List<Object> list) throws ExpressionException
      Compile as expressions what can be compiled in a list.
      Parameters:
      list - the list to convert to expressions
      Returns:
      a promise of a new list containing the results of the evaluations
      Throws:
      ExpressionException - if an error occurs while evaluating the expression
    • from

      public static List<Object> from(List<Object> list, Bindings initialBindings) throws ExpressionException
      Compile as expressions what can be compiled in a list.
      Parameters:
      list - the list to convert to expressions
      initialBindings - the initial bindings to use when the expression will be evaluated
      Returns:
      a promise of a new list containing the results of the evaluations
      Throws:
      ExpressionException - if an error occurs while evaluating the expression
    • from

      public static Expression<Object> from(String value) throws ExpressionException
      Convert a String to a compiled expression.
      Parameters:
      value - the String to compile as expression
      Returns:
      the corresponding compiled expression
      Throws:
      ExpressionException - if an error occurs while compiling the expression
    • from

      public static Expression<Object> from(String value, Bindings initialBindings) throws ExpressionException
      Convert a String to a compiled expression.
      Parameters:
      value - the String to compile as expression
      initialBindings - the initial bindings to use when the expression will be evaluated
      Returns:
      the corresponding compiled expression
      Throws:
      ExpressionException - if an error occurs while compiling the expression
    • from

      public static Object from(Object value) throws ExpressionException
      Compile to expression an Object that may contain some String that needs to be evaluated. The supported types of Object are : String, List and Map.
      Parameters:
      value - the Object to compile to expression
      Returns:
      the result of the compilation. Or the object itself if it has an unsupported type
      Throws:
      ExpressionException - if an error occurs while evaluating the expression
    • from

      public static Object from(Object value, Bindings initialBindings) throws ExpressionException
      Compile to expression an Object that may contain some String that needs to be evaluated. The supported types of Object are : String, List and Map.
      Parameters:
      value - the Object to compile to expression
      initialBindings - the initial bindings to use when the expression will be evaluated
      Returns:
      the result of the compilation. Or the object itself if it has an unsupported type
      Throws:
      ExpressionException - if an error occurs while evaluating the expression