Package org.apache.commons.vfs2.filter
Class AndFileFilter
java.lang.Object
org.apache.commons.vfs2.filter.AndFileFilter
- All Implemented Interfaces:
Serializable
,FileFilter
,ConditionalFileFilter
public class AndFileFilter
extends Object
implements FileFilter, ConditionalFileFilter, Serializable
A filter providing conditional AND logic across a list of file filters. This
filter returns
true
if all filters in the list return true
.
Otherwise, it returns false
. Checking of the file filter list stops
when the first filter returns false
.- Since:
- 2.4
- See Also:
-
- "http://commons.apache.org/proper/commons-io/"
- Serialized Form
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final List<FileFilter>
The list of file filters.private static final long
-
Constructor Summary
ConstructorsConstructorDescriptionDefault constructor.AndFileFilter
(List<FileFilter> fileFilters) Constructs a new instance ofAndFileFilter
with the specified list of filters.AndFileFilter
(FileFilter... filters) Constructs a new file filter that ANDs the result of other filters. -
Method Summary
Modifier and TypeMethodDescriptionboolean
accept
(FileSelectInfo fileSelectInfo) Determines if a file or folder should be selected.void
addFileFilter
(FileFilter fileFilter) Adds the specified file filter to the list of file filters at the end of the list.Returns this conditional file filter's list of file filters.boolean
removeFileFilter
(FileFilter fileFilter) Removes the specified file filter.void
setFileFilters
(List<FileFilter> fileFilters) Sets the list of file filters, replacing any previously configured file filters on this filter.toString()
Provide a String representation of this file filter.
-
Field Details
-
serialVersionUID
private static final long serialVersionUID- See Also:
-
fileFilters
The list of file filters.
-
-
Constructor Details
-
AndFileFilter
public AndFileFilter()Default constructor. -
AndFileFilter
Constructs a new file filter that ANDs the result of other filters.- Parameters:
filters
- array of filters, must not be null or empty
-
AndFileFilter
Constructs a new instance ofAndFileFilter
with the specified list of filters.- Parameters:
fileFilters
- a List of FileFilter instances, copied, null ignored
-
-
Method Details
-
accept
Description copied from interface:FileFilter
Determines if a file or folder should be selected.- Specified by:
accept
in interfaceFileFilter
- Parameters:
fileSelectInfo
- the file or folder to select.- Returns:
- true if the file should be selected.
- Throws:
FileSystemException
- Thrown for file system errors (since 2.4.)
-
addFileFilter
Description copied from interface:ConditionalFileFilter
Adds the specified file filter to the list of file filters at the end of the list.- Specified by:
addFileFilter
in interfaceConditionalFileFilter
- Parameters:
fileFilter
- the filter to be added
-
getFileFilters
Description copied from interface:ConditionalFileFilter
Returns this conditional file filter's list of file filters.- Specified by:
getFileFilters
in interfaceConditionalFileFilter
- Returns:
- the file filter list
-
removeFileFilter
Description copied from interface:ConditionalFileFilter
Removes the specified file filter.- Specified by:
removeFileFilter
in interfaceConditionalFileFilter
- Parameters:
fileFilter
- filter to be removed- Returns:
true
if the filter was found in the list,false
otherwise
-
setFileFilters
Description copied from interface:ConditionalFileFilter
Sets the list of file filters, replacing any previously configured file filters on this filter.- Specified by:
setFileFilters
in interfaceConditionalFileFilter
- Parameters:
fileFilters
- the list of filters
-
toString
Provide a String representation of this file filter.
-