Package org.apache.commons.vfs2.filter
Class OrFileFilter
- java.lang.Object
-
- org.apache.commons.vfs2.filter.OrFileFilter
-
- All Implemented Interfaces:
java.io.Serializable,FileFilter,ConditionalFileFilter
public class OrFileFilter extends java.lang.Object implements FileFilter, ConditionalFileFilter, java.io.Serializable
AFileFilterproviding conditional OR logic across a list of file filters. This filter returnstrueif any filters in the list returntrue. Otherwise, it returnsfalse. Checking of the file filter list stops when the first filter returnstrue.- Since:
- 2.4
- Author:
- This code was originally ported from Apache Commons IO File Filter
- See Also:
- "https://commons.apache.org/proper/commons-io/", Serialized Form
-
-
Constructor Summary
Constructors Constructor Description OrFileFilter()Default constructor.OrFileFilter(java.util.List<FileFilter> fileFilters)Constructs a new instance ofOrFileFilterwith the specified filters.OrFileFilter(FileFilter... filters)Constructs a new file filter that ORs the result of other filters.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanaccept(FileSelectInfo fileSelectInfo)Determines if a file or folder should be selected.voidaddFileFilter(FileFilter fileFilter)Adds the specified file filter to the list of file filters at the end of the list.java.util.List<FileFilter>getFileFilters()Returns this conditional file filter's list of file filters.booleanremoveFileFilter(FileFilter fileFilter)Removes the specified file filter.voidsetFileFilters(java.util.List<FileFilter> fileFilters)Sets the list of file filters, replacing any previously configured file filters on this filter.java.lang.StringtoString()Provide a String representation of this file filter.
-
-
-
Constructor Detail
-
OrFileFilter
public OrFileFilter()
Default constructor.
-
OrFileFilter
public OrFileFilter(FileFilter... filters)
Constructs a new file filter that ORs the result of other filters.- Parameters:
filters- array of filters, must not be null or empty
-
OrFileFilter
public OrFileFilter(java.util.List<FileFilter> fileFilters)
Constructs a new instance ofOrFileFilterwith the specified filters.- Parameters:
fileFilters- the file filters for this filter, copied, null ignored
-
-
Method Detail
-
accept
public boolean accept(FileSelectInfo fileSelectInfo) throws FileSystemException
Description copied from interface:FileFilterDetermines if a file or folder should be selected.- Specified by:
acceptin 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
public void addFileFilter(FileFilter fileFilter)
Description copied from interface:ConditionalFileFilterAdds the specified file filter to the list of file filters at the end of the list.- Specified by:
addFileFilterin interfaceConditionalFileFilter- Parameters:
fileFilter- the filter to be added
-
getFileFilters
public java.util.List<FileFilter> getFileFilters()
Description copied from interface:ConditionalFileFilterReturns this conditional file filter's list of file filters.- Specified by:
getFileFiltersin interfaceConditionalFileFilter- Returns:
- the file filter list
-
removeFileFilter
public boolean removeFileFilter(FileFilter fileFilter)
Description copied from interface:ConditionalFileFilterRemoves the specified file filter.- Specified by:
removeFileFilterin interfaceConditionalFileFilter- Parameters:
fileFilter- filter to be removed- Returns:
trueif the filter was found in the list,falseotherwise
-
setFileFilters
public void setFileFilters(java.util.List<FileFilter> fileFilters)
Description copied from interface:ConditionalFileFilterSets the list of file filters, replacing any previously configured file filters on this filter.- Specified by:
setFileFiltersin interfaceConditionalFileFilter- Parameters:
fileFilters- the list of filters
-
toString
public java.lang.String toString()
Provide a String representation of this file filter.- Overrides:
toStringin classjava.lang.Object- Returns:
- a String representation
-
-