F
- The type that will be filtered.public class CompositeFileListFilter<F> extends Object implements ReversibleFileListFilter<F>, ResettableFileListFilter<F>, Closeable
FileListFilter
that predicates its matches against all of the
configured FileListFilter
.Modifier and Type | Field and Description |
---|---|
protected Set<FileListFilter<F>> |
fileFilters |
Constructor and Description |
---|
CompositeFileListFilter() |
CompositeFileListFilter(Collection<? extends FileListFilter<F>> fileFilters) |
Modifier and Type | Method and Description |
---|---|
CompositeFileListFilter<F> |
addFilter(FileListFilter<F> filter) |
CompositeFileListFilter<F> |
addFilters(Collection<? extends FileListFilter<F>> filtersToAdd)
Not thread safe.
|
CompositeFileListFilter<F> |
addFilters(FileListFilter<F>... filters) |
void |
close() |
List<F> |
filterFiles(F[] files)
Filters out files and returns the files that are left in a list, or an
empty list when a null is passed in.
|
boolean |
remove(F f)
Remove the specified file from the filter so it will pass on the next attempt.
|
void |
rollback(F file,
List<F> files)
Indicate that not all files previously passed by this filter (in
FileListFilter.filterFiles(Object[])
have been processed; the file must be in the list of files; it, and all files after it, will
be considered to have not been processed and will be considered next time. |
protected final Set<FileListFilter<F>> fileFilters
public CompositeFileListFilter()
public CompositeFileListFilter(Collection<? extends FileListFilter<F>> fileFilters)
public void close() throws IOException
close
in interface Closeable
close
in interface AutoCloseable
IOException
public CompositeFileListFilter<F> addFilter(FileListFilter<F> filter)
public CompositeFileListFilter<F> addFilters(FileListFilter<F>... filters)
filters
- one or more new filters to addaddFilters(Collection)
public CompositeFileListFilter<F> addFilters(Collection<? extends FileListFilter<F>> filtersToAdd)
Add the new filters to this CompositeFileListFilter while maintaining the existing filters.
filtersToAdd
- a list of filters to addpublic List<F> filterFiles(F[] files)
FileListFilter
filterFiles
in interface FileListFilter<F>
files
- The files.public void rollback(F file, List<F> files)
ReversibleFileListFilter
FileListFilter.filterFiles(Object[])
have been processed; the file must be in the list of files; it, and all files after it, will
be considered to have not been processed and will be considered next time.rollback
in interface ReversibleFileListFilter<F>
file
- the file which failed.files
- the list of files that were returned by FileListFilter.filterFiles(Object[])
.public boolean remove(F f)
ResettableFileListFilter
remove
in interface ResettableFileListFilter<F>
f
- the element to remove.