Class CompositeFileListFilter<F>
java.lang.Object
org.springframework.integration.file.filters.CompositeFileListFilter<F>
- Type Parameters:
F- The type that will be filtered.
- All Implemented Interfaces:
Closeable,AutoCloseable,DiscardAwareFileListFilter<F>,FileListFilter<F>,ResettableFileListFilter<F>,ReversibleFileListFilter<F>
- Direct Known Subclasses:
ChainFileListFilter
public class CompositeFileListFilter<F>
extends Object
implements ReversibleFileListFilter<F>, ResettableFileListFilter<F>, DiscardAwareFileListFilter<F>, Closeable
Simple
FileListFilter that predicates its matches against all of the
configured FileListFilter.
Note: when discardCallback is provided, it is populated to all the
DiscardAwareFileListFilter delegates. In this case, since this filter
matches the files against all delegates, the discardCallback may be
called several times for the same file.
- Author:
- Iwein Fuld, Josh Long, Gary Russell, Artem Bilan
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionCompositeFileListFilter(Collection<? extends FileListFilter<F>> fileFilters) -
Method Summary
Modifier and TypeMethodDescriptionbooleanFilter a single file; only called externally ifFileListFilter.supportsSingleFileFiltering()returns true.voidaddDiscardCallback(Consumer<F> discardCallbackToSet) addFilter(FileListFilter<F> filter) addFilters(Collection<? extends FileListFilter<F>> filtersToAdd) Add the new filters to this CompositeFileListFilter while maintaining the existing filters.final CompositeFileListFilter<F>addFilters(FileListFilter<F>... filters) voidclose()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.booleanReturn true if this filter is being used for recursion.booleanRemove the specified file from the filter, so it will pass on the next attempt.voidIndicate that not all files previously passed by this filter (inFileListFilter.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.booleanIndicates that this filter supports filtering a single file.
-
Field Details
-
fileFilters
-
-
Constructor Details
-
CompositeFileListFilter
public CompositeFileListFilter() -
CompositeFileListFilter
-
-
Method Details
-
isForRecursion
public boolean isForRecursion()Description copied from interface:FileListFilterReturn true if this filter is being used for recursion.- Specified by:
isForRecursionin interfaceFileListFilter<F>- Returns:
- whether or not to filter based on the full path.
-
close
- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Throws:
IOException
-
addFilter
-
addFilters
- Parameters:
filters- one or more new filters to add- Returns:
- this CompositeFileFilter instance with the added filters
- See Also:
-
addFilters
Add the new filters to this CompositeFileListFilter while maintaining the existing filters.- Parameters:
filtersToAdd- a list of filters to add- Returns:
- this CompositeFileListFilter instance with the added filters
-
addDiscardCallback
- Specified by:
addDiscardCallbackin interfaceDiscardAwareFileListFilter<F>
-
filterFiles
Description copied from interface:FileListFilterFilters out files and returns the files that are left in a list, or an empty list when a null is passed in.- Specified by:
filterFilesin interfaceFileListFilter<F>- Parameters:
files- The files.- Returns:
- The filtered files.
-
accept
Description copied from interface:FileListFilterFilter a single file; only called externally ifFileListFilter.supportsSingleFileFiltering()returns true.- Specified by:
acceptin interfaceFileListFilter<F>- Parameters:
file- the file.- Returns:
- true if the file passes the filter, false to filter.
- See Also:
-
supportsSingleFileFiltering
public boolean supportsSingleFileFiltering()Description copied from interface:FileListFilterIndicates that this filter supports filtering a single file. Filters that return true must overrideFileListFilter.accept(Object). Default false.- Specified by:
supportsSingleFileFilteringin interfaceFileListFilter<F>- Returns:
- true to allow external calls to
FileListFilter.accept(Object). - See Also:
-
rollback
Description copied from interface:ReversibleFileListFilterIndicate that not all files previously passed by this filter (inFileListFilter.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.- Specified by:
rollbackin interfaceReversibleFileListFilter<F>- Parameters:
file- the file which failed.files- the list of files that were returned byFileListFilter.filterFiles(Object[]).
-
remove
Description copied from interface:ResettableFileListFilterRemove the specified file from the filter, so it will pass on the next attempt.- Specified by:
removein interfaceResettableFileListFilter<F>- Parameters:
f- the element to remove.- Returns:
- true if the file was removed as a result of this call.
-