Class LastModifiedFileListFilter
java.lang.Object
org.springframework.integration.file.filters.LastModifiedFileListFilter
- All Implemented Interfaces:
DiscardAwareFileListFilter<File>,FileListFilter<File>
The
FileListFilter implementation to filter those files which
File.lastModified() is less than the age in comparison
with the current time.
The resolution is done in seconds.
When discardCallback is provided, it called for all the
rejected files.
- Since:
- 4.2
- Author:
- Gary Russell, Artem Bilan
-
Constructor Summary
ConstructorsConstructorDescriptionLastModifiedFileListFilter(long age) Construct aLastModifiedFileListFilterinstance with providedage. -
Method Summary
Modifier and TypeMethodDescriptionbooleanFilter a single file; only called externally ifFileListFilter.supportsSingleFileFiltering()returns true.voidaddDiscardCallback(Consumer<File> discardCallbackToSet) filterFiles(File[] files) Filters out files and returns the files that are left in a list, or an empty list when a null is passed in.longgetAge()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.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
-
Constructor Details
-
LastModifiedFileListFilter
public LastModifiedFileListFilter() -
LastModifiedFileListFilter
public LastModifiedFileListFilter(long age) Construct aLastModifiedFileListFilterinstance with providedage. Defaults to 60 seconds.- Parameters:
age- the age in seconds.- Since:
- 5.0
-
-
Method Details
-
setAge
Set the age that files have to be before being passed by this filter. IfFile.lastModified()plus age is greater than the current time, the file is filtered. The resolution is seconds. Defaults to 60 seconds.- Parameters:
age- the ageunit- the timeUnit.
-
setAge
Set the age that files have to be before being passed by this filter. IfFile.lastModified()plus age is greater than the current time, the file is filtered. The resolution is seconds. Defaults to 60 seconds.- Parameters:
age- the age- Since:
- 5.1.3
-
setAge
public void setAge(long age) Set the age that files have to be before being passed by this filter. IfFile.lastModified()plus age is greater than the current time, the file is filtered. The resolution is seconds. Defaults to 60 seconds.- Parameters:
age- the age
-
getAge
public long getAge() -
addDiscardCallback
- Specified by:
addDiscardCallbackin interfaceDiscardAwareFileListFilter<File>
-
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<File>- 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<File>- 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<File>- Returns:
- true to allow external calls to
FileListFilter.accept(Object). - See Also:
-