Class AbstractLastModifiedFileListFilter<F>
java.lang.Object
org.springframework.integration.file.filters.AbstractLastModifiedFileListFilter<F>
- Type Parameters:
F- the file
- All Implemented Interfaces:
DiscardAwareFileListFilter<F>,FileListFilter<F>
- Direct Known Subclasses:
LastModifiedFileListFilter
public abstract class AbstractLastModifiedFileListFilter<F>
extends Object
implements DiscardAwareFileListFilter<F>
The
FileListFilter implementation to filter those files which
lastModified is less than the age in comparison
with the Instant.now().
When discardCallback is provided, it called for all the rejected files.- Since:
- 6.2
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescription -
Method Summary
Modifier and TypeMethodDescriptionbooleanFilter a single file; only called externally ifFileListFilter.supportsSingleFileFiltering()returns true.voidaddDiscardCallback(Consumer<F> discardCallback) 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.protected Durationprotected abstract InstantgetLastModified(F remoteFile) voidsetAge(long age) Set the age that files have to be before being passed by this filter.voidSet the age that files have to be before being passed by this filter.booleanIndicates that this filter supports filtering a single file.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.springframework.integration.file.filters.FileListFilter
isForRecursion
-
Field Details
-
ONE_SECOND
protected static final long ONE_SECOND- See Also:
-
-
Constructor Details
-
AbstractLastModifiedFileListFilter
public AbstractLastModifiedFileListFilter() -
AbstractLastModifiedFileListFilter
-
-
Method Details
-
setAge
Set the age that files have to be before being passed by this filter. If lastModified plusageis before theInstant.now(), the file is filtered. Defaults to 60 seconds.- Parameters:
age- the Duration.
-
setAge
public void setAge(long age) Set the age that files have to be before being passed by this filter. If lastModified plusageis before theInstant.now(), the file is filtered. Defaults to 60 seconds.- Parameters:
age- the age in seconds.
-
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:
-
getAgeDuration
-
getLastModified
-