Class OperatorMatches

All Implemented Interfaces:
Opcodes, SpelNode

public class OperatorMatches extends Operator
Implements the matches operator. Matches takes two operands: The first is a String and the second is a Java regex. It will return true when SpelNodeImpl.getValue(org.springframework.expression.spel.ExpressionState) is called if the first operand matches the regex.
Since:
3.0
Author:
Andy Clement, Juergen Hoeller, Sam Brannen
  • Constructor Details

    • OperatorMatches

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

    • getValueInternal

      public BooleanTypedValue getValueInternal(ExpressionState state) throws EvaluationException
      Check the first operand matches the regex specified as the second operand.
      Specified by:
      getValueInternal in class SpelNodeImpl
      Parameters:
      state - the expression state
      Returns:
      true if the first operand matches the regex specified as the second operand, otherwise false
      Throws:
      EvaluationException - if there is a problem evaluating the expression (e.g. the regex is invalid)