Class PatternTextMatcher

java.lang.Object
org.fest.swing.util.PatternTextMatcher
All Implemented Interfaces:
TextMatcher

public class PatternTextMatcher extends Object implements TextMatcher
Understands matching text to a group of String values. Matching is perform by equality or by regular expression matching.
  • Field Details

    • patterns

      private final Pattern[] patterns
  • Constructor Details

  • Method Details

    • isMatching

      public boolean isMatching(String text)
      Indicates whether the given text matches the regular expression patterns in this matcher.
      Specified by:
      isMatching in interface TextMatcher
      Parameters:
      text - the text to verify.
      Returns:
      true if the given text matches the Pattern values in this matcher, false otherwise.
      Throws:
      NullPointerException - if any of the regular expressions is null.
    • description

      public String description()
      Returns "pattern" if this matcher contains only one pattern, or "patterns" if this matcher contains more than one pattern.
      Specified by:
      description in interface TextMatcher
      Returns:
      "pattern" if this matcher contains only one pattern, or "patterns" if this matcher contains more than one pattern.
    • formattedValues

      public String formattedValues()
      Returns the regular expression patterns in this matcher, formatted as a single String.
      Specified by:
      formattedValues in interface TextMatcher
      Returns:
      the regular expression patterns in this matcher, formatted as a single String.
    • onlyOnePattern

      private boolean onlyOnePattern()