Class OperatorBetween

All Implemented Interfaces:
Opcodes, SpelNode

public class OperatorBetween extends Operator
Represents the between operator.

The left operand must be a single value, and the right operand must be a 2-element list which defines a range from a lower bound to an upper bound.

This operator returns true if the left operand is greater than or equal to the lower bound and less than or equal to the upper bound. Consequently, 1 between {1, 5} evaluates to true, while 1 between {5, 1} evaluates to false.

Andy Clement, Sam Brannen
  • Constructor Details

    • OperatorBetween

      public OperatorBetween(int startPos, int endPos, SpelNodeImpl... operands)
  • Method Details

    • getValueInternal

      public BooleanTypedValue getValueInternal(ExpressionState state) throws EvaluationException
      Returns a boolean based on whether a value is in the range expressed. The first operand is any value whilst the second is a list of two values - those two values being the lower and upper bounds allowed for the first operand (inclusive).
      Specified by:
      getValueInternal in class SpelNodeImpl
      state - the expression state
      true if the left operand is in the range specified, false otherwise
      EvaluationException - if there is a problem evaluating the expression