Skip to content

Commit f37fae6

Browse files
mouyangfmbenhassine
authored andcommitted
Add documentation for how an ItemProcessor.process can never receive a null item.
1 parent da2a5da commit f37fae6

File tree

1 file changed

+4
-2
lines changed
  • spring-batch-infrastructure/src/main/java/org/springframework/batch/item

1 file changed

+4
-2
lines changed

spring-batch-infrastructure/src/main/java/org/springframework/batch/item/ItemProcessor.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616

1717
package org.springframework.batch.item;
1818

19+
import org.springframework.lang.NonNull;
1920
import org.springframework.lang.Nullable;
2021

2122
/**
@@ -36,12 +37,13 @@ public interface ItemProcessor<I, O> {
3637
* processing. If the returned result is null, it is assumed that processing of the item
3738
* should not continue.
3839
*
39-
* @param item to be processed
40+
* @param item to be processed. A {@code null} will never reach this method because the only possible sources
41+
* are ItemReader (which indicates no more items) and ItemProcessor (which indicates a filtered item).
4042
* @return potentially modified or new item for continued processing, {@code null} if processing of the
4143
* provided item should not continue.
4244
*
4345
* @throws Exception thrown if exception occurs during processing.
4446
*/
4547
@Nullable
46-
O process(I item) throws Exception;
48+
O process(@NonNull I item) throws Exception;
4749
}

0 commit comments

Comments
 (0)