Class AggregateItemReader<T>
- java.lang.Object
- org.springframework.batch.sample.domain.multiline.AggregateItemReader<T>
- All Implemented Interfaces:
ItemReader<java.util.List<T>>
public class AggregateItemReader<T> extends java.lang.Object implements ItemReader<java.util.List<T>>
AnItemReaderthat delivers a list as its item, storing up objects from the injectedItemReaderuntil they are ready to be packed out as a collection. This class must be used as a wrapper for a customItemReaderthat can identify the record boundaries. The custom reader should mark the beginning and end of records by returning anAggregateItemwhich responds true to its query methodsis*().
This class is thread-safe (it can be used concurrently by multiple threads) as long as theItemReaderis also thread-safe.- Author:
- Dave Syer
- See Also:
AggregateItem.isHeader(),AggregateItem.isFooter()
Constructor Summary
Constructors Constructor Description AggregateItemReader()
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.util.List<T>read()Get the next list of records.voidsetItemReader(ItemReader<AggregateItem<T>> itemReader)
Method Detail
read
public java.util.List<T> read() throws java.lang.Exception
Get the next list of records.- Specified by:
readin interfaceItemReader<T>- Returns:
- T the item to be processed or
nullif the data source is exhausted - Throws:
ParseException- if there is a problem parsing the current record (but the next one may still be valid)NonTransientResourceException- if there is a fatal exception in the underlying resource. After throwing this exception implementations should endeavour to return null from subsequent calls to read.UnexpectedInputException- if there is an uncategorised problem with the input data. Assume potentially transient, so subsequent calls to read might succeed.java.lang.Exception- if an there is a non-specific error.- See Also:
ItemReader.read()
setItemReader
public void setItemReader(ItemReader<AggregateItem<T>> itemReader)