Class StringMatcher

All Implemented Interfaces:
ElementMatcher<String>, ElementMatcher.Junction<String>

@Enhance public class StringMatcher extends ElementMatcher.Junction.ForNonNullValues<String>
An element matcher that compares two strings by a given pattern which is characterized by a StringMatcher.Mode.
  • Field Details

    • value

      private final String value
      The text value to match against.
    • mode

      private final StringMatcher.Mode mode
      The mode to apply for matching the given value against the matcher's input.
  • Constructor Details

    • StringMatcher

      public StringMatcher(String value, StringMatcher.Mode mode)
      Creates a new string matcher.
      Parameters:
      value - The value that is the base of the matching.
      mode - The mode to apply for matching the given value against the matcher's input
  • Method Details

    • doMatch

      protected boolean doMatch(String target)
      Matches the supplied value if it was found not to be null.
      Specified by:
      doMatch in class ElementMatcher.Junction.ForNonNullValues<String>
      Parameters:
      target - The instance to be matched.
      Returns:
      true if the given element is matched by this matcher or false otherwise.
    • toString

      public String toString()
      Overrides:
      toString in class Object