public class Filters extends Object
The methods in this class are for the most part simple factory methods for various Filter classes, but in some cases provide additional type safety. They also tend to make the code more readable, especially if imported statically, so their use is strongly encouraged in lieu of direct construction of Filter classes.
| Constructor and Description | 
|---|
Filters()  | 
| Modifier and Type | Method and Description | 
|---|---|
static AllFilter | 
all(Filter... filters)
Return a composite filter representing logical AND of all specified filters. 
 | 
static AlwaysFilter | 
always()
Return a filter that always evaluates to true. 
 | 
static AnyFilter | 
any(Filter... filters)
Return a composite filter representing logical OR of all specified filters. 
 | 
static <T,E> Filter<T> | 
arrayContains(ValueExtractor<T,E[]> extractor, E value)
Return a filter that tests if the extracted array contains the specified value. 
 | 
static <T,E> Filter<T> | 
arrayContainsAll(ValueExtractor<T,E[]> extractor, E... values)
Return a filter that tests if the extracted array contains all of the specified values. 
 | 
static <T,E> Filter<T> | 
arrayContainsAll(ValueExtractor<T,E[]> extractor, Set<? extends E> setValues)
Return a filter that tests if the extracted array contains all of the specified values. 
 | 
static <T,E> Filter<T> | 
arrayContainsAny(ValueExtractor<T,E[]> extractor, E... values)
Return a filter that tests if the extracted array contains any of the specified values. 
 | 
static <T,E> Filter<T> | 
arrayContainsAny(ValueExtractor<T,E[]> extractor, Set<? extends E> setValues)
Return a filter that tests if the extracted array contains any of the specified values. 
 | 
static <T,E extends Comparable<? super E>> | 
between(ValueExtractor<T,? extends E> extractor, E from, E to)
Return a filter that tests if the extracted value is between the specified values (inclusive). 
 | 
static <T,E,C extends Collection<? extends E>> | 
contains(ValueExtractor<T,C> extractor, E value)
Return a filter that tests if the extracted collection contains the specified value. 
 | 
static <T,E,C extends Collection<? extends E>> | 
containsAll(ValueExtractor<T,C> extractor, E... values)
Return a filter that tests if the extracted collection contains all of the specified values. 
 | 
static <T,E,C extends Collection<? extends E>> | 
containsAll(ValueExtractor<T,C> extractor, Set<? extends E> setValues)
Return a filter that tests if the extracted collection contains all of the specified values. 
 | 
static <T,E,C extends Collection<? extends E>> | 
containsAny(ValueExtractor<T,C> extractor, E... values)
Return a filter that tests if the extracted collection contains any of the specified values. 
 | 
static <T,E,C extends Collection<? extends E>> | 
containsAny(ValueExtractor<T,C> extractor, Set<? extends E> setValues)
Return a filter that tests if the extracted collection contains any of the specified values. 
 | 
static <T,E> EqualsFilter<T,E> | 
equal(ValueExtractor<T,? extends E> extractor, E value)
Return a filter that tests for equality. 
 | 
static <T,E extends Comparable<? super E>> | 
greater(ValueExtractor<T,? extends E> extractor, E value)
Return a filter that tests if the extracted value is greater than the specified value. 
 | 
static <T,E extends Comparable<? super E>> | 
greaterEqual(ValueExtractor<T,? extends E> extractor, E value)
Return a filter that tests if the extracted value is greater than or equal to the specified value. 
 | 
static <T,E> InFilter<T,E> | 
in(ValueExtractor<T,? extends E> extractor, E... values)
Return a filter that tests if the extracted value is contained in the specified array. 
 | 
static <T,E> InFilter<T,E> | 
in(ValueExtractor<T,? extends E> extractor, Set<? extends E> setValues)
Return a filter that tests if the extracted value is contained in the specified set. 
 | 
static <T,E> IsNotNullFilter<T,E> | 
isNotNull(ValueExtractor<T,E> extractor)
Return a filter that evaluates to true for non-null values. 
 | 
static <T,E> IsNullFilter<T,E> | 
isNull(ValueExtractor<T,E> extractor)
Return a filter that evaluates to true for null values. 
 | 
static <T,E extends Comparable<? super E>> | 
less(ValueExtractor<T,? extends E> extractor, E value)
Return a filter that tests if the extracted value is less than the specified value. 
 | 
static <T,E extends Comparable<? super E>> | 
lessEqual(ValueExtractor<T,? extends E> extractor, E value)
Return a filter that tests if the extracted value is less than or equal to the specified value. 
 | 
static <T,E> LikeFilter<T,E> | 
like(ValueExtractor<T,E> extractor, String sPattern)
Return a LikeFilter for pattern match. 
 | 
static <T,E> LikeFilter<T,E> | 
like(ValueExtractor<T,E> extractor, String sPattern, boolean fIgnoreCase)
Return a LikeFilter for pattern match. 
 | 
static <T,E> LikeFilter<T,E> | 
like(ValueExtractor<T,E> extractor, String sPattern, char chEscape)
Return a LikeFilter for pattern match. 
 | 
static <T,E> LikeFilter<T,E> | 
like(ValueExtractor<T,E> extractor, String sPattern, char chEscape, boolean fIgnoreCase)
Return a LikeFilter for pattern match. 
 | 
static NeverFilter | 
never()
Return a filter that always evaluates to false. 
 | 
static <T> Filter<T> | 
not(Filter<T> filter)
Return a filter that represents the logical negation of the specified filter. 
 | 
static <T,E> NotEqualsFilter<T,E> | 
notEqual(ValueExtractor<T,? extends E> extractor, E value)
Return a filter that tests for non-equality. 
 | 
static <T> PredicateFilter<T,T> | 
predicate(Remote.Predicate<T> predicate)
Return a PredicateFilter for a given  
Predicate. | 
static <T,E> PredicateFilter<T,E> | 
predicate(ValueExtractor<T,? extends E> extractor, Remote.Predicate<? super E> predicate)
Return a PredicateFilter for a given  
Predicate. | 
static PresentFilter | 
present()
Return a filter that evaluates to true if an entry is present in the cache. 
 | 
static <T,E> RegexFilter<T,E> | 
regex(ValueExtractor<T,E> extractor, String sRegex)
Return a RegexFilter for pattern match. 
 | 
public static AllFilter all(Filter... filters)
filters - an array of filtersAllFilterpublic static AnyFilter any(Filter... filters)
filters - an array of filtersAnyFilterpublic static AlwaysFilter always()
AlwaysFilterpublic static NeverFilter never()
NeverFilterpublic static PresentFilter present()
PresentFilterpublic static <T> Filter<T> not(Filter<T> filter)
NotFilterpublic static <T,E> IsNullFilter<T,E> isNull(ValueExtractor<T,E> extractor)
T - the type of the object to extract value fromE - the type of extracted valueextractor - the ValueExtractor to useIsNullFilterpublic static <T,E> IsNotNullFilter<T,E> isNotNull(ValueExtractor<T,E> extractor)
T - the type of the object to extract value fromE - the type of extracted valueextractor - the ValueExtractor to useIsNotNullFilterpublic static <T,E> EqualsFilter<T,E> equal(ValueExtractor<T,? extends E> extractor, E value)
T - the type of the object to extract value fromE - the type of extracted valueextractor - the ValueExtractor to usevalue - the value to compare the extracted value withEqualsFilterpublic static <T,E> NotEqualsFilter<T,E> notEqual(ValueExtractor<T,? extends E> extractor, E value)
T - the type of the object to extract value fromE - the type of extracted valueextractor - the ValueExtractor to usevalue - the value to compare the extracted value withNotEqualsFilterpublic static <T,E extends Comparable<? super E>> LessFilter<T,E> less(ValueExtractor<T,? extends E> extractor, E value)
T - the type of the object to extract value fromE - the type of extracted valueextractor - the ValueExtractor to usevalue - the value to compare the extracted value withLessFilterpublic static <T,E extends Comparable<? super E>> LessEqualsFilter<T,E> lessEqual(ValueExtractor<T,? extends E> extractor, E value)
T - the type of the object to extract value fromE - the type of extracted valueextractor - the ValueExtractor to usevalue - the value to compare the extracted value withLessEqualsFilterpublic static <T,E extends Comparable<? super E>> GreaterFilter<T,E> greater(ValueExtractor<T,? extends E> extractor, E value)
T - the type of the object to extract value fromE - the type of extracted valueextractor - the ValueExtractor to usevalue - the value to compare the extracted value withGreaterFilterpublic static <T,E extends Comparable<? super E>> GreaterEqualsFilter<T,E> greaterEqual(ValueExtractor<T,? extends E> extractor, E value)
T - the type of the object to extract value fromE - the type of extracted valueextractor - the ValueExtractor to usevalue - the value to compare the extracted value withGreaterEqualsFilterpublic static <T,E extends Comparable<? super E>> BetweenFilter<T,E> between(ValueExtractor<T,? extends E> extractor, E from, E to)
T - the type of the object to extract value fromE - the type of extracted valueextractor - the ValueExtractor to usefrom - the lower bound to compare the extracted value withto - the upper bound to compare the extracted value withBetweenFilterpublic static <T,E,C extends Collection<? extends E>> Filter<T> contains(ValueExtractor<T,C> extractor, E value)
T - the type of the object to extract value fromE - the type of extracted valueextractor - the ValueExtractor to usevalue - the value to compare the extracted value withContainsFilterpublic static <T,E> Filter<T> arrayContains(ValueExtractor<T,E[]> extractor, E value)
T - the type of the object to extract value fromE - the type of extracted valueextractor - the ValueExtractor to usevalue - the value to compare the extracted value withContainsFilterpublic static <T,E,C extends Collection<? extends E>> Filter<T> containsAll(ValueExtractor<T,C> extractor, Set<? extends E> setValues)
T - the type of the object to extract value fromE - the type of extracted valueextractor - the ValueExtractor to usesetValues - the values to compare the extracted value withContainsAllFilter@SafeVarargs public static <T,E,C extends Collection<? extends E>> Filter<T> containsAll(ValueExtractor<T,C> extractor, E... values)
T - the type of the object to extract value fromE - the type of extracted valueextractor - the ValueExtractor to usevalues - the values to compare the extracted value withContainsAllFilterpublic static <T,E> Filter<T> arrayContainsAll(ValueExtractor<T,E[]> extractor, Set<? extends E> setValues)
T - the type of the object to extract value fromE - the type of extracted valueextractor - the ValueExtractor to usesetValues - the values to compare the extracted value withContainsAllFilter@SafeVarargs public static <T,E> Filter<T> arrayContainsAll(ValueExtractor<T,E[]> extractor, E... values)
T - the type of the object to extract value fromE - the type of extracted valueextractor - the ValueExtractor to usevalues - the values to compare the extracted value withContainsAllFilterpublic static <T,E,C extends Collection<? extends E>> Filter<T> containsAny(ValueExtractor<T,C> extractor, Set<? extends E> setValues)
T - the type of the object to extract value fromE - the type of extracted valueextractor - the ValueExtractor to usesetValues - the values to compare the extracted value withContainsAnyFilter@SafeVarargs public static <T,E,C extends Collection<? extends E>> Filter<T> containsAny(ValueExtractor<T,C> extractor, E... values)
T - the type of the object to extract value fromE - the type of extracted valueextractor - the ValueExtractor to usevalues - the values to compare the extracted value withContainsAnyFilterpublic static <T,E> Filter<T> arrayContainsAny(ValueExtractor<T,E[]> extractor, Set<? extends E> setValues)
T - the type of the object to extract value fromE - the type of extracted valueextractor - the ValueExtractor to usesetValues - the values to compare the extracted value withContainsAnyFilter@SafeVarargs public static <T,E> Filter<T> arrayContainsAny(ValueExtractor<T,E[]> extractor, E... values)
T - the type of the object to extract value fromE - the type of extracted valueextractor - the ValueExtractor to usevalues - the values to compare the extracted value withContainsAnyFilterpublic static <T,E> InFilter<T,E> in(ValueExtractor<T,? extends E> extractor, Set<? extends E> setValues)
T - the type of the object to extract value fromE - the type of extracted valueextractor - the ValueExtractor to usesetValues - the values to compare the extracted value withContainsAnyFilter@SafeVarargs public static <T,E> InFilter<T,E> in(ValueExtractor<T,? extends E> extractor, E... values)
T - the type of the object to extract value fromE - the type of extracted valueextractor - the ValueExtractor to usevalues - the values to compare the extracted value withContainsAnyFilterpublic static <T,E> LikeFilter<T,E> like(ValueExtractor<T,E> extractor, String sPattern)
T - the type of the object to extract value fromE - the type of extracted valueextractor - the ValueExtractor to use by this filtersPattern - the string pattern to compare the result withpublic static <T,E> LikeFilter<T,E> like(ValueExtractor<T,E> extractor, String sPattern, char chEscape)
T - the type of the object to extract value fromE - the type of extracted valueextractor - the ValueExtractor to use by this filtersPattern - the string pattern to compare the result withchEscape - the escape character for escaping '%' and '_'public static <T,E> LikeFilter<T,E> like(ValueExtractor<T,E> extractor, String sPattern, boolean fIgnoreCase)
T - the type of the object to extract value fromE - the type of extracted valueextractor - the ValueExtractor to use by this filtersPattern - the string pattern to compare the result withfIgnoreCase - true to be case-insensitivepublic static <T,E> LikeFilter<T,E> like(ValueExtractor<T,E> extractor, String sPattern, char chEscape, boolean fIgnoreCase)
T - the type of the object to extract value fromE - the type of extracted valueextractor - the ValueExtractor to use by this filtersPattern - the string pattern to compare the result withchEscape - the escape character for escaping '%' and '_'fIgnoreCase - true to be case-insensitivepublic static <T,E> RegexFilter<T,E> regex(ValueExtractor<T,E> extractor, String sRegex)
T - the type of the object to extract value fromE - the type of extracted valueextractor - the ValueExtractor to use by this filtersRegex - the regular expression to match the result withpublic static <T> PredicateFilter<T,T> predicate(Remote.Predicate<T> predicate)
Predicate.T - the type of the object to evaluatepredicate - the predicate to evaluatepublic static <T,E> PredicateFilter<T,E> predicate(ValueExtractor<T,? extends E> extractor, Remote.Predicate<? super E> predicate)
Predicate.T - the type of the object to extract value fromE - the type of extracted value to evaluateextractor - the ValueExtractor to use by this filterpredicate - the predicate to evaluate