public class Predicates extends Object
| Modifier and Type | Field and Description |
|---|---|
private static Pattern |
LITERAL_SEPARATOR_PATTERN |
| Modifier | Constructor and Description |
|---|---|
private |
Predicates() |
| Modifier and Type | Method and Description |
|---|---|
static Predicate<String> |
excludes(String regexPatterns)
Generate a predicate function that for any supplied string returns
true if none of the regular
expressions in the supplied comma-separated list matches the predicate parameter. |
static <T> Predicate<T> |
excludes(String regexPatterns,
Function<T,String> conversion)
Generate a predicate function that for any supplied parameter returns
true if none of the regular
expressions in the supplied comma-separated list matches the predicate parameter. |
static Predicate<String> |
excludesLiterals(String literals)
Generate a predicate function that for any supplied string returns
true if none of the literals in
the supplied comma-separated list case insensitively matches the predicate parameter. |
static <T> Predicate<T> |
excludesLiterals(String literals,
Function<T,String> conversion)
Generate a predicate function that for any supplied string returns
true if none of the literals in
the supplied comma-separated list case insensitively matches the predicate parameter. |
static <T> Predicate<T> |
excludesLiteralsOrPatterns(String patterns,
Predicate<String> isLiteral,
Function<T,String> conversion)
Generate a predicate function that for any supplied string returns
true if none of the regular
expressions or literals in the supplied comma-separated list matches the predicate parameter. |
static Predicate<String> |
excludesUuids(String uuidPatterns)
Generate a predicate function that for any supplied string returns
true if none of the regular
expressions or literals in the supplied comma-separated list matches the predicate parameter. |
static <T> Predicate<T> |
filter(Predicate<T> allowed,
Predicate<T> disallowed)
Create a predicate function that allows only those values are allowed or not disallowed by the supplied predicates.
|
protected static <T> Predicate<T> |
includedInLiterals(Collection<String> literals,
Function<T,String> conversion) |
protected static <T,U> BiPredicate<T,U> |
includedInPatterns(Collection<Pattern> patterns,
BiFunction<T,U,String> conversion) |
protected static <T> Predicate<T> |
includedInPatterns(Collection<Pattern> patterns,
Function<T,String> conversion) |
static Predicate<String> |
includes(String regexPatterns)
Generate a predicate function that for any supplied string returns
true if any of the regular expressions in
the supplied comma-separated list matches the predicate parameter. |
static <T,U> BiPredicate<T,U> |
includes(String regexPatterns,
BiFunction<T,U,String> conversion) |
static <T> Predicate<T> |
includes(String regexPatterns,
Function<T,String> conversion)
Generate a predicate function that for any supplied parameter returns
true if any of the regular expressions
in the supplied comma-separated list matches the predicate parameter in a case-insensitive manner. |
static Predicate<String> |
includesLiterals(String literals)
Generate a predicate function that for any supplied string returns
true if any of the literals in
the supplied comma-separated list case insensitively matches the predicate parameter. |
static <T> Predicate<T> |
includesLiterals(String literals,
Function<T,String> conversion)
Generate a predicate function that for any supplied string returns
true if any of the literals in
the supplied comma-separated list case insensitively matches the predicate parameter. |
static <T> Predicate<T> |
includesLiteralsOrPatterns(String literalsOrPatterns,
Predicate<String> isLiteral,
Function<T,String> conversion)
Generate a predicate function that for any supplied string returns
true if any of the regular expressions
or literals in the supplied comma-separated list matches the predicate parameter. |
static Predicate<String> |
includesUuids(String uuidPatterns)
Generate a predicate function that for any supplied UUID strings returns
true if any of the comma-separated
UUID literals or regular expressions matches the predicate parameter. |
static Function<String,Optional<Pattern>> |
matchedBy(String regexPatterns)
Generate a predicate function that for any supplied string returns a
Pattern representing the first regular expression
in the supplied comma-separated list that matches the predicate parameter in a case-insensitive manner. |
protected static <T,U> BiFunction<T,U,Optional<Pattern>> |
matchedByPattern(Collection<Pattern> patterns,
BiFunction<T,U,String> conversion) |
protected static <T> Function<T,Optional<Pattern>> |
matchedByPattern(Collection<Pattern> patterns,
Function<T,String> conversion) |
static <R> Predicate<R> |
not(Predicate<R> predicate) |
static <T> Predicate<T> |
notNull() |
private static final Pattern LITERAL_SEPARATOR_PATTERN
public static Predicate<String> includesUuids(String uuidPatterns)
true if any of the comma-separated
UUID literals or regular expressions matches the predicate parameter. This supplied strings can be a mixture
of regular expressions and UUID literals, and the most efficient method will be used for each.uuidPatterns - the comma-separated UUID literals or regular expression patterns; may not be nullPatternSyntaxException - if the string includes an invalid regular expressionpublic static Predicate<String> excludesUuids(String uuidPatterns)
true if none of the regular
expressions or literals in the supplied comma-separated list matches the predicate parameter. This supplied strings can be
a mixture of regular expressions and UUID literals, and the most efficient method will be used for each.uuidPatterns - the comma-separated regular expression pattern (or literal) strings; may not be nullPatternSyntaxException - if the string includes an invalid regular expressionpublic static <T> Predicate<T> includesLiteralsOrPatterns(String literalsOrPatterns, Predicate<String> isLiteral, Function<T,String> conversion)
true if any of the regular expressions
or literals in the supplied comma-separated list matches the predicate parameter. This supplied strings can be a mixture
of regular expressions and literals, and the most efficient method will be used for each.literalsOrPatterns - the comma-separated regular expression pattern (or literal) strings; may not be nullisLiteral - function that determines if a given pattern is a literal string; may not be nullconversion - the function that converts each predicate-supplied value to a string that can be matched against the
regular expressions; may not be nullPatternSyntaxException - if the string includes an invalid regular expressionpublic static <T> Predicate<T> excludesLiteralsOrPatterns(String patterns, Predicate<String> isLiteral, Function<T,String> conversion)
true if none of the regular
expressions or literals in the supplied comma-separated list matches the predicate parameter. This supplied strings can be
a mixture of regular expressions and literals, and the most efficient method will be used for each.patterns - the comma-separated regular expression pattern (or literal) strings; may not be nullisLiteral - function that determines if a given pattern is a literal string; may not be nullconversion - the function that converts each predicate-supplied value to a string that can be matched against the
regular expressions; may not be nullPatternSyntaxException - if the string includes an invalid regular expressionpublic static Predicate<String> includesLiterals(String literals)
true if any of the literals in
the supplied comma-separated list case insensitively matches the predicate parameter.literals - the comma-separated literal strings; may not be nullpublic static Predicate<String> excludesLiterals(String literals)
true if none of the literals in
the supplied comma-separated list case insensitively matches the predicate parameter.literals - the comma-separated literal strings; may not be nullpublic static <T> Predicate<T> includesLiterals(String literals, Function<T,String> conversion)
true if any of the literals in
the supplied comma-separated list case insensitively matches the predicate parameter.literals - the comma-separated literal strings; may not be nullconversion - the function that converts each predicate-supplied value to a string that can be matched against the
regular expressions; may not be nullpublic static <T> Predicate<T> excludesLiterals(String literals, Function<T,String> conversion)
true if none of the literals in
the supplied comma-separated list case insensitively matches the predicate parameter.literals - the comma-separated literal strings; may not be nullconversion - the function that converts each predicate-supplied value to a string that can be matched against the
regular expressions; may not be nullpublic static Predicate<String> includes(String regexPatterns)
true if any of the regular expressions in
the supplied comma-separated list matches the predicate parameter.regexPatterns - the comma-separated regular expression pattern (or literal) strings; may not be nullPatternSyntaxException - if the string includes an invalid regular expressionpublic static Predicate<String> excludes(String regexPatterns)
true if none of the regular
expressions in the supplied comma-separated list matches the predicate parameter.regexPatterns - the comma-separated regular expression pattern (or literal) strings; may not be nullPatternSyntaxException - if the string includes an invalid regular expressionpublic static <T> Predicate<T> includes(String regexPatterns, Function<T,String> conversion)
true if any of the regular expressions
in the supplied comma-separated list matches the predicate parameter in a case-insensitive manner.regexPatterns - the comma-separated regular expression pattern (or literal) strings; may not be nullconversion - the function that converts each predicate-supplied value to a string that can be matched against the
regular expressions; may not be nullPatternSyntaxException - if the string includes an invalid regular expressionpublic static <T,U> BiPredicate<T,U> includes(String regexPatterns, BiFunction<T,U,String> conversion)
protected static <T> Predicate<T> includedInPatterns(Collection<Pattern> patterns, Function<T,String> conversion)
protected static <T,U> BiPredicate<T,U> includedInPatterns(Collection<Pattern> patterns, BiFunction<T,U,String> conversion)
public static Function<String,Optional<Pattern>> matchedBy(String regexPatterns)
Pattern representing the first regular expression
in the supplied comma-separated list that matches the predicate parameter in a case-insensitive manner.regexPatterns - the comma-separated regular expression pattern (or literal) strings; may not be nullPatternSyntaxException - if the string includes an invalid regular expressionprotected static <T> Function<T,Optional<Pattern>> matchedByPattern(Collection<Pattern> patterns, Function<T,String> conversion)
protected static <T,U> BiFunction<T,U,Optional<Pattern>> matchedByPattern(Collection<Pattern> patterns, BiFunction<T,U,String> conversion)
protected static <T> Predicate<T> includedInLiterals(Collection<String> literals, Function<T,String> conversion)
public static <T> Predicate<T> excludes(String regexPatterns, Function<T,String> conversion)
true if none of the regular
expressions in the supplied comma-separated list matches the predicate parameter.regexPatterns - the comma-separated regular expression pattern (or literal) strings; may not be nullconversion - the function that converts each predicate-supplied value to a string that can be matched against the
regular expressions; may not be nullPatternSyntaxException - if the string includes an invalid regular expressionpublic static <T> Predicate<T> filter(Predicate<T> allowed, Predicate<T> disallowed)
allowed - the predicate that defines the allowed values; may be nulldisallowed - the predicate that defines the disallowed values; may be nullpublic static <T> Predicate<T> notNull()
Copyright © 2020 JBoss by Red Hat. All rights reserved.