Class ExpressionPropertyCondition

    • Field Detail

      • functionMap

        protected Map<String,​Function<String,​Boolean>> functionMap
        A map that associates a string key with a function for evaluating boolean conditions.

        This map defines the known functions. It can be overridden by subclasses to define new functions.

        In the context of this class, a function is a function that takes a String argument and returns a boolean.

      • biFunctionMap

        protected Map<String,​BiFunction<String,​String,​Boolean>> biFunctionMap
        A map that associates a string key with a bi-function for evaluating boolean conditions.

        This map defines the known bi-functions. It can be overridden by subclasses to define new bi-functions.

        In the context of this class, a bi-function is a function that takes two String arguments and returns a boolean.

    • Constructor Detail

      • ExpressionPropertyCondition

        public ExpressionPropertyCondition()
        Constructs an ExpressionPropertyCondition and initializes the function maps with supported unary and binary functions.
    • Method Detail

      • start

        public void start()
        Starts the condition by parsing the expression into tokens and converting them to Reverse Polish Notation (RPN) for evaluation.

        In case of malformed expression, the instance will not enter the "started" state.

        Specified by:
        start in interface LifeCycle
        Overrides:
        start in class PropertyConditionBase
      • getExpression

        public String getExpression()
        Returns the current expression string.
        Returns:
        the expression, or null if not set
      • setExpression

        public void setExpression​(String expression)
        Sets the expression to be evaluated.
        Parameters:
        expression - the boolean expression string
      • evaluate

        public boolean evaluate()
        Evaluates the parsed expression against the current property context.

        If the instance is not in started state, returns false.

        Returns:
        true if the expression evaluates to true, false otherwise