Package org.fest.swing.util
Class PatternTextMatcher
java.lang.Object
org.fest.swing.util.PatternTextMatcher
- All Implemented Interfaces:
TextMatcher
Understands matching text to a group of
String
values. Matching is perform by equality or by regular
expression matching.-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionReturns "pattern" if this matcher contains only one pattern, or "patterns" if this matcher contains more than one pattern.Returns the regular expression patterns in this matcher, formatted as a singleString
.boolean
isMatching
(String text) Indicates whether the given text matches the regular expression patterns in this matcher.private boolean
-
Field Details
-
patterns
-
-
Constructor Details
-
PatternTextMatcher
Creates a newPatternTextMatcher
.- Parameters:
patterns
- the regular expression patterns to match.- Throws:
NullPointerException
- if the array of patterns isnull
.IllegalArgumentException
- if the array of patterns is empty.
-
-
Method Details
-
isMatching
Indicates whether the given text matches the regular expression patterns in this matcher.- Specified by:
isMatching
in interfaceTextMatcher
- Parameters:
text
- the text to verify.- Returns:
true
if the given text matches thePattern
values in this matcher,false
otherwise.- Throws:
NullPointerException
- if any of the regular expressions isnull
.
-
description
Returns "pattern" if this matcher contains only one pattern, or "patterns" if this matcher contains more than one pattern.- Specified by:
description
in interfaceTextMatcher
- Returns:
- "pattern" if this matcher contains only one pattern, or "patterns" if this matcher contains more than one pattern.
-
formattedValues
Returns the regular expression patterns in this matcher, formatted as a singleString
.- Specified by:
formattedValues
in interfaceTextMatcher
- Returns:
- the regular expression patterns in this matcher, formatted as a single
String
.
-
onlyOnePattern
private boolean onlyOnePattern()
-