GH-3372: Expose (S)FTP remoteComparator for DSL

Fixes https://github.com/spring-projects/spring-integration/issues/3372

**Cherry-pick to 5.3.x & 5.2.x**
This commit is contained in:
Artem Bilan
2020-09-14 16:15:23 -04:00
committed by Gary Russell
parent 059bc896ff
commit 411e9945c3
2 changed files with 18 additions and 3 deletions

View File

@@ -17,6 +17,7 @@
package org.springframework.integration.file.dsl;
import java.io.File;
import java.util.Comparator;
import java.util.LinkedHashMap;
import java.util.Map;
import java.util.function.Function;
@@ -282,6 +283,18 @@ public abstract class RemoteFileInboundChannelAdapterSpec<F, S extends RemoteFil
return _this();
}
/**
* Set a comparator to sort the retrieved list of {@code F} (the Type that represents
* the remote file) prior to applying filters and max fetch size.
* @param remoteComparator the {@link Comparator} for remote files.
* @return the spec.
* @since 5.2.9
*/
public S remoteComparator(Comparator<F> remoteComparator) {
this.synchronizer.setComparator(remoteComparator);
return _this();
}
@Override
public Map<Object, String> getComponentsToRegister() {
Map<Object, String> componentsToRegister = new LinkedHashMap<>();