类 AbstractPaginatedDataItemReader<T>
- java.lang.Object
- org.springframework.batch.item.ItemStreamSupport
- org.springframework.batch.item.support.AbstractItemStreamItemReader<T>
- org.springframework.batch.item.support.AbstractItemCountingItemStreamItemReader<T>
- org.springframework.batch.item.data.AbstractPaginatedDataItemReader<T>
- 类型参数:
T- Type of item to be read
- 所有已实现的接口:
ItemReader<T>,ItemStream,ItemStreamReader<T>
public abstract class AbstractPaginatedDataItemReader<T> extends AbstractItemCountingItemStreamItemReader<T>
A base class that handles basic reading logic based on the paginated semantics of Spring Data's paginated facilities. It also handles the semantics required for restartability based on those facilities.- 从以下版本开始:
- 2.2
- 作者:
- Michael Minella, Glenn Renfro
构造器概要
构造器 构造器 说明 AbstractPaginatedDataItemReader()
方法概要
所有方法 实例方法 抽象方法 具体方法 修饰符和类型 方法 说明 protected voiddoClose()Close the resources opened inAbstractItemCountingItemStreamItemReader.doOpen().protected voiddoOpen()Open resources necessary to start reading input.protected abstract java.util.Iterator<T>doPageRead()Method thisItemStreamReaderdelegates to for the actual work of reading a page.protected TdoRead()Read next item from input.protected voidjumpToItem(int itemLastIndex)Move to the given item index.voidsetPageSize(int pageSize)The number of items to be read with each page.从类继承的方法 org.springframework.batch.item.support.AbstractItemCountingItemStreamItemReader
close, getCurrentItemCount, isSaveState, open, read, setCurrentItemCount, setMaxItemCount, setSaveState, update
从类继承的方法 org.springframework.batch.item.ItemStreamSupport
getExecutionContextKey, setExecutionContextName, setName
构造器详细资料
AbstractPaginatedDataItemReader
public AbstractPaginatedDataItemReader()
方法详细资料
setPageSize
public void setPageSize(int pageSize)
The number of items to be read with each page.- 参数:
pageSize- the number of items. pageSize must be greater than zero.
doRead
protected T doRead() throws java.lang.Exception
Read next item from input.- 指定者:
doRead在类中AbstractItemCountingItemStreamItemReader<T>- 返回:
- an item or
nullif the data source is exhausted - 抛出:
java.lang.Exception- Allows subclasses to throw checked exceptions for interpretation by the framework
doPageRead
protected abstract java.util.Iterator<T> doPageRead()
Method thisItemStreamReaderdelegates to for the actual work of reading a page. Each time this method is called, the resultingIteratorshould contain the items read within the next page.
If theIteratoris empty or null when it is returned, thisItemReaderwill assume that the input has been exhausted.- 返回:
- an
Iteratorcontaining the items within a page.
doOpen
protected void doOpen() throws java.lang.Exception
Open resources necessary to start reading input.- 指定者:
doOpen在类中AbstractItemCountingItemStreamItemReader<T>- 抛出:
java.lang.Exception- Allows subclasses to throw checked exceptions for interpretation by the framework
doClose
protected void doClose() throws java.lang.Exception
Close the resources opened inAbstractItemCountingItemStreamItemReader.doOpen().- 指定者:
doClose在类中AbstractItemCountingItemStreamItemReader<T>- 抛出:
java.lang.Exception- Allows subclasses to throw checked exceptions for interpretation by the framework
jumpToItem
protected void jumpToItem(int itemLastIndex) throws java.lang.Exception
Move to the given item index. Subclasses should override this method if there is a more efficient way of moving to given index than re-reading the input usingAbstractItemCountingItemStreamItemReader.doRead().- 覆盖:
jumpToItem在类中AbstractItemCountingItemStreamItemReader<T>- 参数:
itemLastIndex- index of item (0 based) to jump to.- 抛出:
java.lang.Exception- Allows subclasses to throw checked exceptions for interpretation by the framework