Class AbstractRecentFileListFilter<F>
java.lang.Object
org.springframework.integration.file.filters.AbstractRecentFileListFilter<F>
- Type Parameters:
F
- The type that will be filtered.
- All Implemented Interfaces:
FileListFilter<F>
- Direct Known Subclasses:
FtpRecentFileListFilter
,RecentFileListFilter
,SftpRecentFileListFilter
,SmbRecentFileListFilter
The
FileListFilter
to accept only files which are recent according to provided age
:
the lastModified
of the file is more than the age in comparison with the current time.
In other words, accept those files which are not old enough yet.- Since:
- 6.5
- Author:
- Artem Bilan
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionConstruct an instance with default age as 1 day. -
Method Summary
Modifier and TypeMethodDescriptionboolean
Filter a single file; only called externally ifFileListFilter.supportsSingleFileFiltering()
returns true.protected boolean
fileIsAged
(F file, Instant now) 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 abstract Instant
getLastModified
(F remoteFile) boolean
Indicates 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, wait
Methods inherited from interface org.springframework.integration.file.filters.FileListFilter
isForRecursion
-
Field Details
-
ONE_SECOND
protected static final long ONE_SECOND- See Also:
-
-
Constructor Details
-
AbstractRecentFileListFilter
public AbstractRecentFileListFilter()Construct an instance with default age as 1 day. -
AbstractRecentFileListFilter
-
-
Method Details
-
supportsSingleFileFiltering
public boolean supportsSingleFileFiltering()Description copied from interface:FileListFilter
Indicates that this filter supports filtering a single file. Filters that return true must overrideFileListFilter.accept(Object)
. Default false.- Specified by:
supportsSingleFileFiltering
in interfaceFileListFilter<F>
- Returns:
- true to allow external calls to
FileListFilter.accept(Object)
. - See Also:
-
filterFiles
Description copied from interface:FileListFilter
Filters out files and returns the files that are left in a list, or an empty list when a null is passed in.- Specified by:
filterFiles
in interfaceFileListFilter<F>
- Parameters:
files
- The files.- Returns:
- The filtered files.
-
accept
Description copied from interface:FileListFilter
Filter a single file; only called externally ifFileListFilter.supportsSingleFileFiltering()
returns true.- Specified by:
accept
in interfaceFileListFilter<F>
- Parameters:
file
- the file.- Returns:
- true if the file passes the filter, false to filter.
- See Also:
-
fileIsAged
-
getLastModified
-