Package org.forgerock.openig.el
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 Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static Promise<Object,NeverThrowsException>
evaluateAsync(Object value, Bindings bindings)
Evaluate an Object that may contain some expressions that needs to be evaluated.static Promise<List<Object>,NeverThrowsException>
evaluateAsync(List<Object> list, Bindings bindings)
Evaluate a list that may contain some Expressions that needs to be evaluated.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.static Object
from(Object value)
Compile to expression an Object that may contain some String that needs to be evaluated.static Object
from(Object value, Bindings initialBindings)
Compile to expression an Object that may contain some String that needs to be evaluated.static Expression<Object>
from(String value)
Convert a String to a compiled expression.static Expression<Object>
from(String value, Bindings initialBindings)
Convert a String to a compiled expression.static List<Object>
from(List<Object> list)
Compile as expressions what can be compiled in a list.static List<Object>
from(List<Object> list, Bindings initialBindings)
Compile as expressions what can be compiled in a list.static Map<String,Object>
from(Map<String,Object> map)
Compile a map that may contain some values that needs to be transformed as expression.static Map<String,Object>
from(Map<String,Object> map, Bindings initialBindings)
Compile a map that may contain some values that needs to be transformed as expression.
-
-
-
Method Detail
-
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 evaluatebindings
- 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 evaluatebindings
- 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 evaluatebindings
- 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 expressionsinitialBindings
- 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 expressionsinitialBindings
- 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 expressioninitialBindings
- 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 expressioninitialBindings
- 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
-
-