T
- the typepublic class CompositeFilter<T> extends java.lang.Object implements Filterable<T>, Filter<T>
CompositeFilter
class implements the Filterable
interface as well as the Filter
interface for a specific type.Filterable.Mode
Filter.Instances
Constructor and Description |
---|
CompositeFilter()
Constructs a new
CompositeFilter instance with the default
state. |
Modifier and Type | Method and Description |
---|---|
void |
addFilter(Filter<T> filter,
Filterable.Mode mode)
Add the given filter to this
Filterable object and combine it
with any previously added filters according to the given mode. |
Filter<T> |
getFilter()
Get the current filter for this
Filterable object. |
boolean |
isEmpty() |
boolean |
matches(T value)
Returns whether the given object meets the requirements of this filter or not.
|
boolean |
removeFilter(Filter<T> filter)
Remove the given filter from this
Filterable object. |
void |
setFilter(Filter<T> filter)
Set the filter on this
Filterable object. |
public CompositeFilter()
CompositeFilter
instance with the default
state. The base/default filter will allow any match. This is the same as
invoking new CompositeFilter(Filter.Instances.acceptsAll())
.public void addFilter(Filter<T> filter, Filterable.Mode mode)
Filterable
Filterable
object and combine it
with any previously added filters according to the given mode.addFilter
in interface Filterable<T>
public boolean removeFilter(Filter<T> filter)
Filterable
Filterable
object.removeFilter
in interface Filterable<T>
filter
- the filtertrue
if thepublic boolean matches(T value)
Filter
public void setFilter(Filter<T> filter)
Filterable
Filterable
object. This will replace
any previously set or added filters.setFilter
in interface Filterable<T>
filter
- the new filterpublic Filter<T> getFilter()
Filterable
Filterable
object.getFilter
in interface Filterable<T>
null
if nonepublic boolean isEmpty()