public final class AndClassFilter extends java.lang.Object implements ClassFilter
An AndClassFilter logically ANDs other
ClassFilter
objects. When its accept()
method is called, the AndClassFilter object passes
the class name through the contained filters. The class name is only
accepted if it is accepted by all contained filters. This
class conceptually provides a logical "AND" operator for class name
filters.
The contained filters are applied in the order they were added to
the AndClassFilter object. This class's
accept()
method stops looping over the contained filters
as soon as it encounters one whose accept() method returns
false (implementing a "short-circuited AND" operation.)
ClassFilter
,
OrClassFilter
,
NotClassFilter
,
ClassFinder
Constructor and Description |
---|
AndClassFilter()
Construct a new AndClassFilter with no contained filters.
|
AndClassFilter(ClassFilter... filters)
Construct a new AndClassFilter with a set of contained
filters.
|
Modifier and Type | Method and Description |
---|---|
boolean |
accept(ClassInfo classInfo,
ClassFinder classFinder)
Determine whether a class name is to be accepted or not, based on
the contained filters.
|
AndClassFilter |
addFilter(ClassFilter filter)
Add a filter to the set of contained filters.
|
java.util.Collection<ClassFilter> |
getFilters()
Get the contained filters, as an unmodifiable collection.
|
int |
getTotalFilters()
Get the total number of contained filter objects (not counting any
filter objects they, in turn, contain).
|
void |
removeFilter(ClassFilter filter)
Remove a filter from the set of contained filters.
|
public AndClassFilter()
public AndClassFilter(ClassFilter... filters)
addFilter()
method.filters
- filters to addpublic AndClassFilter addFilter(ClassFilter filter)
filter
- the ClassFilter to add.removeFilter(org.clapper.util.classutil.ClassFilter)
public void removeFilter(ClassFilter filter)
filter
- the ClassFilter to remove.addFilter(org.clapper.util.classutil.ClassFilter)
public java.util.Collection<ClassFilter> getFilters()
public int getTotalFilters()
public boolean accept(ClassInfo classInfo, ClassFinder classFinder)
Determine whether a class name is to be accepted or not, based on
the contained filters. The class name is accepted if any one of the
contained filters accepts it. This method stops looping over the
contained filters as soon as it encounters one whose
accept()
method returns
false (implementing a "short-circuited AND" operation.)
If the set of contained filters is empty, then this method returns true.
accept
in interface ClassFilter
classInfo
- the ClassInfo
object to testclassFinder
- the invoking ClassFinder
object