Interface StringMatcher

All Superinterfaces:
Predicate<String>

public interface StringMatcher extends Predicate<String>
An interface for allowing direct string matching or regular expressions. Use the static factory string(String) or regex(String) to instantiate the appropriate matcher. Custom implementations should override Object.toString() for better error reporting.
  • Method Details

    • string

      static StringMatcher string(String string)
      Create a matcher for string equality.
    • regex

      static StringMatcher regex(String string) throws RegexSyntaxException
      Create a matcher using regular expressions. Regex matching ignores null values and returns false instead of erroring.
      Parameters:
      string - the input pattern
      Returns:
      a regex based instance
      Throws:
      RegexSyntaxException - if the input pattern is not valid regex. This is a runtime exception and probably should be handled