@FunctionalInterface @API(status=STABLE, since="1.0") public interface Filter<T>
Filter
can be applied to determine if an object should be
included or excluded in a result set.
For example, tests may be filtered during or after test discovery based on certain criteria.
Clients should not implement this interface directly but rather one of its subinterfaces.
DiscoveryFilter
Modifier and Type | Method and Description |
---|---|
static <T,V> Filter<T> |
adaptFilter(Filter<V> adaptee,
Function<T,V> converter)
Return a filter that will include elements if and only if the adapted
Filter includes the value converted using the supplied
Function . |
FilterResult |
apply(T object)
Apply this filter to the supplied object.
|
static <T> Filter<T> |
composeFilters(Collection<? extends Filter<T>> filters)
Return a filter that will include elements if and only if all of the
filters in the supplied collection of
filters include it. |
static <T> Filter<T> |
composeFilters(Filter<T>... filters)
Return a filter that will include elements if and only if all of the
filters in the supplied array of
filters include it. |
default Predicate<T> |
toPredicate()
|
@SafeVarargs static <T> Filter<T> composeFilters(Filter<T>... filters)
filters
include it.
If the array is empty, the returned filter will include all elements it is asked to filter.
filters
- the array of filters to compose; never null
composeFilters(Collection)
static <T> Filter<T> composeFilters(Collection<? extends Filter<T>> filters)
filters
include it.
If the collection is empty, the returned filter will include all elements it is asked to filter.
filters
- the collection of filters to compose; never null
composeFilters(Filter...)
static <T,V> Filter<T> adaptFilter(Filter<V> adaptee, Function<T,V> converter)
Filter
includes the value converted using the supplied
Function
.adaptee
- the filter to be adaptedconverter
- the converter function to applyFilterResult apply(T object)