Class IteratorItemReader<T>
- java.lang.Object
- org.springframework.batch.item.support.IteratorItemReader<T>
- All Implemented Interfaces:
ItemReader<T>
public class IteratorItemReader<T> extends java.lang.Object implements ItemReader<T>
- Author:
- Juliusz Brzostek, Dave Syer
Constructor Summary
Constructors Constructor Description IteratorItemReader(java.lang.Iterable<T> iterable)Construct a new reader from this iterable (could be a collection), by extracting an instance ofIteratorfrom it.IteratorItemReader(java.util.Iterator<T> iterator)Construct a new reader from this iterator directly.
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Tread()Implementation ofItemReader.read()that just iterates over the iterator provided.
Constructor Detail
IteratorItemReader
public IteratorItemReader(java.lang.Iterable<T> iterable)
Construct a new reader from this iterable (could be a collection), by extracting an instance ofIteratorfrom it.- Parameters:
iterable- in instance ofIterable- See Also:
Iterable.iterator()
IteratorItemReader
public IteratorItemReader(java.util.Iterator<T> iterator)
Construct a new reader from this iterator directly.- Parameters:
iterator- an instance ofIterator
Method Detail
read
public T read()
Implementation ofItemReader.read()that just iterates over the iterator provided.- Specified by:
readin interfaceItemReader<T>- Returns:
- T the item to be processed or
nullif the data source is exhausted