22:toc: left
33:toclevels: 4
44
5- [[processor ]]
6- == ItemProcessor
5+ [[itemProcessor ]]
6+ == Item processing
77
88ifndef::onlyonetoggle[]
99include::toggle.adoc[]
1010endif::onlyonetoggle[]
1111
12- The ` ItemReader` and ` ItemWriter` interfaces are both very useful for their specific
12+ The <<readersAndWriters.adoc#readersAndWriters, ItemReader and ItemWriter interfaces>> are both very useful for their specific
1313tasks, but what if you want to insert business logic before writing? One option for both
1414reading and writing is to use the composite pattern: Create an `ItemWriter` that contains
1515another `ItemWriter` or an `ItemReader` that contains another `ItemReader`. The following
@@ -117,7 +117,7 @@ public Job ioSampleJob() {
117117@Bean
118118public Step step1() {
119119 return this.stepBuilderFactory.get("step1")
120- .<String, String >chunk(2)
120+ .<Foo, Bar >chunk(2)
121121 .reader(fooReader())
122122 .processor(fooProcessor())
123123 .writer(barWriter())
@@ -129,7 +129,7 @@ A difference between `ItemProcessor` and `ItemReader` or `ItemWriter` is that an
129129is optional for a `Step`.
130130
131131[[chainingItemProcessors]]
132- ==== Chaining ItemProcessors
132+ === Chaining ItemProcessors
133133
134134Performing a single transformation is useful in many scenarios, but what if you want to
135135'chain' together multiple `ItemProcessor` implementations? This can be accomplished using
@@ -223,7 +223,7 @@ public Job ioSampleJob() {
223223@Bean
224224public Step step1() {
225225 return this.stepBuilderFactory.get("step1")
226- .<String, String >chunk(2)
226+ .<Foo, Foobar >chunk(2)
227227 .reader(fooReader())
228228 .processor(compositeProcessor())
229229 .writer(foobarWriter())
@@ -245,7 +245,7 @@ public CompositeItemProcessor compositeProcessor() {
245245----
246246
247247[[filteringRecords]]
248- ==== Filtering Records
248+ === Filtering Records
249249
250250One typical use for an item processor is to filter out records before they are passed to
251251the `ItemWriter`. Filtering is an action distinct from skipping. Skipping indicates that
@@ -265,7 +265,7 @@ the `ItemWriter`. As usual, an exception thrown from the `ItemProcessor` results
265265skip.
266266
267267[[validatingInput]]
268- ==== Validating Input
268+ === Validating Input
269269
270270In the <<readersAndWriters.adoc#readersAndWriters,ItemReaders and ItemWriters>> chapter, multiple approaches to parsing input have been
271271discussed. Each major implementation throws an exception if it is not 'well-formed'. The
@@ -369,7 +369,7 @@ public BeanValidatingItemProcessor<Person> beanValidatingItemProcessor() throws
369369----
370370
371371[[faultTolerant]]
372- ==== Fault Tolerance
372+ === Fault Tolerance
373373
374374When a chunk is rolled back, items that have been cached during reading may be
375375reprocessed. If a step is configured to be fault tolerant (typically by using skip or
0 commit comments