Class Expressions


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

      • evaluate

        public static Map<String,​Object> evaluate​(Map<String,​Object> map,
                                                        Bindings bindings)
                                                 throws ExpressionException
        Evaluate a map that may contain some values that needs to be evaluated.
        Parameters:
        map - the map to evaluate
        bindings - the bindings used for the evaluation
        Returns:
        a new Map containing the result of the evaluation.
        Throws:
        ExpressionException - if an error occurs while evaluating the expression
      • evaluate

        public static List<Object> evaluate​(List<Object> list,
                                            Bindings bindings)
                                     throws ExpressionException
        Evaluate a list that may contain some String that needs to be evaluated.
        Parameters:
        list - the list to evaluate
        bindings - the bindings used for the evaluation
        Returns:
        a new list containing the results of the evaluations
        Throws:
        ExpressionException - if an error occurs while evaluating the expression
      • evaluate

        public static Object evaluate​(String value,
                                      Bindings bindings)
                               throws ExpressionException
        Evaluate a String.
        Parameters:
        value - the String to evaluate
        bindings - the bindings used for the evaluation
        Returns:
        the result of the evaluation.
        Throws:
        ExpressionException - if an error occurs while evaluating the expression
      • evaluateKey

        public static String evaluateKey​(String key,
                                         Bindings bindings)
        Evaluate a String. The original key value is returned if an ExpressionException is thrown while evaluating the key value, used for configurations where the key can also be an expression.
        Parameters:
        key - the String to evaluate.
        bindings - the bindings used for the evaluation.
        Returns:
        the result of the evaluation or the original value if there was a ExpressionException during evaluation.
      • evaluate

        public static Object evaluate​(Object value,
                                      Bindings bindings)
                               throws ExpressionException
        Evaluate 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 String to evaluate
        bindings - the bindings used for the evaluation
        Returns:
        the result of the evaluation.
        Throws:
        ExpressionException - if an error occurs while evaluating the expression