Package com.gengoai.string
Interface StringMatcher
-
- All Superinterfaces:
Predicate<CharSequence>
,Serializable
,SerializablePredicate<CharSequence>
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
@FunctionalInterface public interface StringMatcher extends SerializablePredicate<CharSequence>
A
StringMatcher
is aSerializablePredicate
forCharSequence
s testing if CharSequences match a specific pattern.- Author:
- David B. Bracewell
-
-
Field Summary
Fields Modifier and Type Field Description static StringMatcher
Digit
Matches digit only CharSequencesstatic StringMatcher
HasDigit
Matches CharSequences containing digitsstatic StringMatcher
HasLetter
Matches CharSequences containing lettersstatic StringMatcher
HasLetterOrDigit
Matches CharSequences containing letter or digitsstatic StringMatcher
HasLowerCase
Matches CharSequences containing lower casestatic StringMatcher
HasPunctuation
Matches CharSequences containing punctuation.static StringMatcher
HasUpperCase
Matches CharSequences containing upper casestatic StringMatcher
Letter
Matches CharSequences that are only lettersstatic StringMatcher
LetterOrDigit
Matches CharSequences that are only letter or digitsstatic StringMatcher
LetterOrWhitespace
Matches CharSequences containing all letter or whitespacestatic StringMatcher
LowerCase
Matches CharSequences that are only lower casestatic StringMatcher
NotNull
Matches CharSequences that are not null.static StringMatcher
NotNullOrBlank
Matches CharSequences that are not null or blankstatic StringMatcher
Null
Matches CharSequences are nullstatic StringMatcher
NullOrBlank
Matches CharSequences that are null or blankstatic StringMatcher
Punctuation
Matches punctuation only CharSequencesstatic StringMatcher
UpperCase
Matches upper case only CharSequences
-
Method Summary
All Methods Static Methods Instance Methods Default Methods Modifier and Type Method Description default StringMatcher
and(SerializablePredicate<? super CharSequence> other)
static StringMatcher
contains(String match)
String matcher that evaluates true if the CharSequence contains the given string to match.static StringMatcher
contains(String match, boolean caseSensitive)
String matcher that evaluates true if the CharSequence contains the given string to match.static StringMatcher
endsWith(String match)
String matcher that evaluates true if the CharSequence ends with the given string to match.static StringMatcher
endsWith(String match, boolean caseSensitive)
String matcher that evaluates true if the CharSequence ends with the given string to match.static StringMatcher
matches(String match)
String matcher that evaluates true if the CharSequence matches the given string to match.static StringMatcher
matches(String match, boolean caseSensitive)
String matcher that evaluates true if the CharSequence matches the given string to match.default StringMatcher
negate()
default StringMatcher
or(SerializablePredicate<? super CharSequence> other)
static StringMatcher
regex(String pattern)
String matcher that evaluates true if the CharSequence is matched using the given regex.static StringMatcher
regex(Pattern pattern)
String matcher that evaluates true if the CharSequence is matched using the given regex.static StringMatcher
startsWith(String match)
String matcher that evaluates true if the CharSequence starts with the given string to match.static StringMatcher
startsWith(String match, boolean caseSensitive)
String matcher that evaluates true if the CharSequence starts with the given string to match.-
Methods inherited from interface com.gengoai.function.SerializablePredicate
and, or
-
-
-
-
Field Detail
-
NotNull
static final StringMatcher NotNull
Matches CharSequences that are not null.
-
HasPunctuation
static final StringMatcher HasPunctuation
Matches CharSequences containing punctuation.
-
HasUpperCase
static final StringMatcher HasUpperCase
Matches CharSequences containing upper case
-
HasLowerCase
static final StringMatcher HasLowerCase
Matches CharSequences containing lower case
-
HasLetter
static final StringMatcher HasLetter
Matches CharSequences containing letters
-
HasDigit
static final StringMatcher HasDigit
Matches CharSequences containing digits
-
HasLetterOrDigit
static final StringMatcher HasLetterOrDigit
Matches CharSequences containing letter or digits
-
LetterOrWhitespace
static final StringMatcher LetterOrWhitespace
Matches CharSequences containing all letter or whitespace
-
Null
static final StringMatcher Null
Matches CharSequences are null
-
NullOrBlank
static final StringMatcher NullOrBlank
Matches CharSequences that are null or blank
-
NotNullOrBlank
static final StringMatcher NotNullOrBlank
Matches CharSequences that are not null or blank
-
LowerCase
static final StringMatcher LowerCase
Matches CharSequences that are only lower case
-
Letter
static final StringMatcher Letter
Matches CharSequences that are only letters
-
LetterOrDigit
static final StringMatcher LetterOrDigit
Matches CharSequences that are only letter or digits
-
Digit
static final StringMatcher Digit
Matches digit only CharSequences
-
Punctuation
static final StringMatcher Punctuation
Matches punctuation only CharSequences
-
UpperCase
static final StringMatcher UpperCase
Matches upper case only CharSequences
-
-
Method Detail
-
contains
static StringMatcher contains(String match)
String matcher that evaluates true if the CharSequence contains the given string to match.- Parameters:
match
- the string to match- Returns:
- the string matcher
-
contains
static StringMatcher contains(String match, boolean caseSensitive)
String matcher that evaluates true if the CharSequence contains the given string to match.- Parameters:
match
- the string to matchcaseSensitive
- True case sensitive match, False case insensitive match.- Returns:
- the string matcher
-
endsWith
static StringMatcher endsWith(String match)
String matcher that evaluates true if the CharSequence ends with the given string to match.- Parameters:
match
- the string to match- Returns:
- the string matcher
-
endsWith
static StringMatcher endsWith(String match, boolean caseSensitive)
String matcher that evaluates true if the CharSequence ends with the given string to match.- Parameters:
match
- the string to matchcaseSensitive
- True case sensitive match, False case insensitive match.- Returns:
- the string matcher
-
matches
static StringMatcher matches(String match)
String matcher that evaluates true if the CharSequence matches the given string to match.- Parameters:
match
- the string to match- Returns:
- the string matcher
-
matches
static StringMatcher matches(String match, boolean caseSensitive)
String matcher that evaluates true if the CharSequence matches the given string to match.- Parameters:
match
- the string to matchcaseSensitive
- True case sensitive match, False case insensitive match.- Returns:
- the string matcher
-
regex
static StringMatcher regex(Pattern pattern)
String matcher that evaluates true if the CharSequence is matched using the given regex.- Parameters:
pattern
- the pattern to match- Returns:
- the string matcher
-
regex
static StringMatcher regex(String pattern)
String matcher that evaluates true if the CharSequence is matched using the given regex.- Parameters:
pattern
- the pattern to match- Returns:
- the string matcher
-
startsWith
static StringMatcher startsWith(String match)
String matcher that evaluates true if the CharSequence starts with the given string to match.- Parameters:
match
- the string to match- Returns:
- the string matcher
-
startsWith
static StringMatcher startsWith(String match, boolean caseSensitive)
String matcher that evaluates true if the CharSequence starts with the given string to match.- Parameters:
match
- the string to matchcaseSensitive
- True case sensitive match, False case insensitive match.- Returns:
- the string matcher
-
and
default StringMatcher and(SerializablePredicate<? super CharSequence> other)
- Specified by:
and
in interfaceSerializablePredicate<CharSequence>
-
negate
default StringMatcher negate()
- Specified by:
negate
in interfacePredicate<CharSequence>
- Specified by:
negate
in interfaceSerializablePredicate<CharSequence>
-
or
default StringMatcher or(SerializablePredicate<? super CharSequence> other)
- Specified by:
or
in interfaceSerializablePredicate<CharSequence>
-
-