org.springframework.batch.sample.domain.multiline
Class AggregateItemReader<T>

java.lang.Object
  extended by org.springframework.batch.sample.domain.multiline.AggregateItemReader<T>
All Implemented Interfaces:
ItemReader<List<T>>

public class AggregateItemReader<T>
extends Object
implements ItemReader<List<T>>

An ItemReader that delivers a list as its item, storing up objects from the injected ItemReader until they are ready to be packed out as a collection. This class must be used as a wrapper for a custom ItemReader that can identify the record boundaries. The custom reader should mark the beginning and end of records by returning an AggregateItem which responds true to its query methods is*().

This class is thread safe (it can be used concurrently by multiple threads) as long as the ItemReader is also thread safe.

Author:
Dave Syer
See Also:
AggregateItem.isHeader(), AggregateItem.isFooter()

Constructor Summary
AggregateItemReader()
           
 
Method Summary
 List<T> read()
          Get the next list of records.
 void setItemReader(ItemReader<AggregateItem<T>> itemReader)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AggregateItemReader

public AggregateItemReader()
Method Detail

read

public List<T> read()
             throws Exception
Get the next list of records.

Specified by:
read in interface ItemReader<List<T>>
Throws:
Exception
See Also:
ItemReader.read()

setItemReader

public void setItemReader(ItemReader<AggregateItem<T>> itemReader)


Copyright © 2009 SpringSource. All Rights Reserved.