public final class OrClassFilter extends java.lang.Object implements ClassFilter
An OrClassFilter contains logically ORs other
ClassFilter
objects. When its accept()
method is called, the OrClassFilter object passes
the class name through the contained filters. The class name is
accepted if it is accepted by any one of the contained filters. This
class conceptually provides a logical "OR" operator for class name
filters.
The contained filters are applied in the order they were added to
the OrClassFilter object. This class's
accept()
method stops looping over the contained filters
as soon as it encounters one whose accept() method returns
true (implementing a "short-circuited OR" operation.)
ClassFilter
,
OrClassFilter
,
NotClassFilter
,
ClassFinder
Constructor and Description |
---|
OrClassFilter()
Construct a new OrClassFilter with no contained filters.
|
OrClassFilter(ClassFilter... filters)
Construct a new OrClassFilter with two 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.
|
OrClassFilter |
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 OrClassFilter()
public OrClassFilter(ClassFilter... filters)
addFilter()
method.filters
- filters to addpublic OrClassFilter 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 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
true (implementing a "short-circuited OR" 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