public class OrFileFilter extends AbstractFileFilter implements ConditionalFileFilter, java.io.Serializable
FileFilter providing conditional OR logic across a list of
file filters. This filter returns true if any filters in the
list return true. Otherwise, it returns false.
Checking of the file filter list stops when the first filter returns
true.FileFilterUtils.or(IOFileFilter...),
Serialized Form| Modifier and Type | Field and Description |
|---|---|
private java.util.List<IOFileFilter> |
fileFilters
The list of file filters.
|
private static long |
serialVersionUID |
| Constructor and Description |
|---|
OrFileFilter()
Constructs a new instance of
OrFileFilter. |
OrFileFilter(IOFileFilter filter1,
IOFileFilter filter2)
Constructs a new file filter that ORs the result of two other filters.
|
OrFileFilter(java.util.List<IOFileFilter> fileFilters)
Constructs a new instance of
OrFileFilter
with the specified filters. |
| Modifier and Type | Method and Description |
|---|---|
boolean |
accept(java.io.File file)
Checks to see if the File should be accepted by this filter.
|
boolean |
accept(java.io.File file,
java.lang.String name)
Checks to see if the File should be accepted by this filter.
|
void |
addFileFilter(IOFileFilter ioFileFilter)
Adds the specified file filter to the list of file filters at the end of
the list.
|
java.util.List<IOFileFilter> |
getFileFilters()
Returns this conditional file filter's list of file filters.
|
boolean |
removeFileFilter(IOFileFilter ioFileFilter)
Removes the specified file filter.
|
void |
setFileFilters(java.util.List<IOFileFilter> fileFilters)
Sets the list of file filters, replacing any previously configured
file filters on this filter.
|
java.lang.String |
toString()
Provide a String representaion of this file filter.
|
private static final long serialVersionUID
private final java.util.List<IOFileFilter> fileFilters
public OrFileFilter()
OrFileFilter.public OrFileFilter(java.util.List<IOFileFilter> fileFilters)
OrFileFilter
with the specified filters.fileFilters - the file filters for this filter, copied, null ignoredpublic OrFileFilter(IOFileFilter filter1, IOFileFilter filter2)
filter1 - the first filter, must not be nullfilter2 - the second filter, must not be nulljava.lang.IllegalArgumentException - if either filter is nullpublic void addFileFilter(IOFileFilter ioFileFilter)
addFileFilter in interface ConditionalFileFilterioFileFilter - the filter to be addedpublic java.util.List<IOFileFilter> getFileFilters()
getFileFilters in interface ConditionalFileFilterpublic boolean removeFileFilter(IOFileFilter ioFileFilter)
removeFileFilter in interface ConditionalFileFilterioFileFilter - filter to be removedtrue if the filter was found in the list,
false otherwisepublic void setFileFilters(java.util.List<IOFileFilter> fileFilters)
setFileFilters in interface ConditionalFileFilterfileFilters - the list of filterspublic boolean accept(java.io.File file)
accept in interface java.io.FileFilteraccept in interface IOFileFilteraccept in class AbstractFileFilterfile - the File to checkpublic boolean accept(java.io.File file,
java.lang.String name)
accept in interface java.io.FilenameFilteraccept in interface IOFileFilteraccept in class AbstractFileFilterfile - the directory File to checkname - the filename within the directory to checkpublic java.lang.String toString()
toString in class AbstractFileFilterCopyright (c) 2002-2016 Apache Software Foundation