2424import org .jspecify .annotations .Nullable ;
2525
2626import org .springframework .expression .Expression ;
27+ import org .springframework .integration .expression .SupplierExpression ;
28+ import org .springframework .integration .expression .ValueExpression ;
2729import org .springframework .integration .file .transformer .FileToByteArrayTransformer ;
2830import org .springframework .integration .file .transformer .FileToStringTransformer ;
2931import org .springframework .messaging .Message ;
@@ -43,7 +45,7 @@ public abstract class Files {
4345 * @return the {@link FileInboundChannelAdapterSpec} instance.
4446 */
4547 public static FileInboundChannelAdapterSpec inboundAdapter (File directory ) {
46- return inboundAdapter (() -> directory );
48+ return inboundAdapter (directory , null );
4749 }
4850
4951 /**
@@ -65,7 +67,8 @@ public static FileInboundChannelAdapterSpec inboundAdapter(Supplier<File> direct
6567 public static FileInboundChannelAdapterSpec inboundAdapter (File directory ,
6668 @ Nullable Comparator <File > receptionOrderComparator ) {
6769
68- return inboundAdapter (() -> directory , null );
70+ return new FileInboundChannelAdapterSpec (receptionOrderComparator )
71+ .directory (new ValueExpression <>(directory ));
6972 }
7073
7174 /**
@@ -78,7 +81,8 @@ public static FileInboundChannelAdapterSpec inboundAdapter(File directory,
7881 public static FileInboundChannelAdapterSpec inboundAdapter (Supplier <File > directorySupplier ,
7982 @ Nullable Comparator <File > receptionOrderComparator ) {
8083
81- return new FileInboundChannelAdapterSpec (receptionOrderComparator ).directory (directorySupplier );
84+ return new FileInboundChannelAdapterSpec (receptionOrderComparator )
85+ .directory (new SupplierExpression <>(directorySupplier ));
8286 }
8387
8488 /**
@@ -92,7 +96,7 @@ public static FileWritingMessageHandlerSpec outboundAdapter(File destinationDire
9296
9397 /**
9498 * Create a {@link FileWritingMessageHandlerSpec} builder for the one-way {@code FileWritingMessageHandler}.
95- * @param directoryExpression the SpEL expression to evaluate target directory for writing files.
99+ * @param directoryExpression the SpEL expression to evaluate the target directory for writing files.
96100 * @return the {@link FileWritingMessageHandlerSpec} instance.
97101 */
98102 public static FileWritingMessageHandlerSpec outboundAdapter (String directoryExpression ) {
@@ -129,7 +133,7 @@ public static FileWritingMessageHandlerSpec outboundGateway(File destinationDire
129133
130134 /**
131135 * Create a {@link FileWritingMessageHandlerSpec} builder for the gateway {@code FileWritingMessageHandler}.
132- * @param directoryExpression the SpEL expression to evaluate target directory for writing files.
136+ * @param directoryExpression the SpEL expression to evaluate the target directory for writing files.
133137 * @return the {@link FileWritingMessageHandlerSpec} instance.
134138 */
135139 public static FileWritingMessageHandlerSpec outboundGateway (String directoryExpression ) {
@@ -193,15 +197,15 @@ public static FileSplitterSpec splitter(boolean iterator, boolean markers) {
193197 }
194198
195199 /**
196- * Create a {@link FileToStringTransformer} instance with default {@code charset} and no delete files afterwards .
200+ * Create a {@link FileToStringTransformer} instance with default {@code charset} and no delete files afterward .
197201 * @return the {@link FileToStringTransformer}.
198202 */
199203 public static FileToStringTransformer toStringTransformer () {
200204 return toStringTransformer (false );
201205 }
202206
203207 /**
204- * Create a {@link FileToStringTransformer} instance with default {@code charset} and with delete files flag .
208+ * Create a {@link FileToStringTransformer} instance with default {@code charset} and the flag to delete files.
205209 * @param deleteFiles true to delete the file.
206210 * @return the {@link FileToStringTransformer}.
207211 */
@@ -210,7 +214,7 @@ public static FileToStringTransformer toStringTransformer(boolean deleteFiles) {
210214 }
211215
212216 /**
213- * Create a {@link FileToStringTransformer} instance with provided {@code charset} and no delete files afterwards .
217+ * Create a {@link FileToStringTransformer} instance with provided {@code charset} and no delete files afterward .
214218 * @param charset The charset.
215219 * @return the {@link FileToStringTransformer}.
216220 */
@@ -219,7 +223,7 @@ public static FileToStringTransformer toStringTransformer(String charset) {
219223 }
220224
221225 /**
222- * Create a {@link FileToStringTransformer} instance with provided {@code charset} and delete files flag .
226+ * Create a {@link FileToStringTransformer} instance with provided {@code charset} and the flag to delete files.
223227 * @param charset The charset.
224228 * @param deleteFiles true to delete the file.
225229 * @return the {@link FileToStringTransformer}.
@@ -244,7 +248,7 @@ public static FileToByteArrayTransformer toByteArrayTransformer() {
244248 /**
245249 * Create a {@link FileToByteArrayTransformer} instance.
246250 * @param deleteFiles specify whether to delete the File after transformation.
247- * Default is <em> false</em> .
251+ * Default is {@code false} .
248252 * @return the {@link FileToByteArrayTransformer}.
249253 */
250254 public static FileToByteArrayTransformer toByteArrayTransformer (boolean deleteFiles ) {
0 commit comments