类 AbstractPagingItemReader<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.database.AbstractPagingItemReader<T>
- 所有已实现的接口:
ItemReader<T>
,ItemStream
,ItemStreamReader<T>
,org.springframework.beans.factory.InitializingBean
public abstract class AbstractPagingItemReader<T> extends AbstractItemCountingItemStreamItemReader<T> implements org.springframework.beans.factory.InitializingBean
AbstractItemStreamReader
for to extend when reading database records in a paging fashion.Implementations should execute queries using paged requests of a size specified in
setPageSize(int)
. Additional pages are requested when needed asAbstractItemCountingItemStreamItemReader.read()
method is called, returning an object corresponding to current position.- 从以下版本开始:
- 2.0
- 作者:
- Thomas Risberg, Dave Syer
构造器概要
构造器 构造器 说明 AbstractPagingItemReader()
方法概要
所有方法 实例方法 抽象方法 具体方法 修饰符和类型 方法 说明 void
afterPropertiesSet()
Check mandatory properties.protected void
doClose()
Close the resources opened inAbstractItemCountingItemStreamItemReader.doOpen()
.protected abstract void
doJumpToPage(int itemIndex)
protected void
doOpen()
Open resources necessary to start reading input.protected T
doRead()
Read next item from input.protected abstract void
doReadPage()
int
getPage()
The current page number.int
getPageSize()
The page size configured for this reader.protected void
jumpToItem(int itemIndex)
Move to the given item index.void
setPageSize(int pageSize)
The number of rows to retrieve at a time.从类继承的方法 org.springframework.batch.item.support.AbstractItemCountingItemStreamItemReader
close, getCurrentItemCount, isSaveState, open, read, setCurrentItemCount, setMaxItemCount, setSaveState, update
从类继承的方法 org.springframework.batch.item.ItemStreamSupport
getExecutionContextKey, setExecutionContextName, setName
构造器详细资料
AbstractPagingItemReader
public AbstractPagingItemReader()
方法详细资料
getPage
public int getPage()
The current page number.- 返回:
- the current page
getPageSize
public int getPageSize()
The page size configured for this reader.- 返回:
- the page size
setPageSize
public void setPageSize(int pageSize)
The number of rows to retrieve at a time.- 参数:
pageSize
- the number of rows to fetch per page
afterPropertiesSet
public void afterPropertiesSet() throws java.lang.Exception
Check mandatory properties.- 指定者:
afterPropertiesSet
在接口中org.springframework.beans.factory.InitializingBean
- 抛出:
java.lang.Exception
- 另请参阅:
InitializingBean.afterPropertiesSet()
doRead
protected T doRead() throws java.lang.Exception
Read next item from input.- 指定者:
doRead
在类中AbstractItemCountingItemStreamItemReader<T>
- 返回:
- an item or
null
if the data source is exhausted - 抛出:
java.lang.Exception
- Allows subclasses to throw checked exceptions for interpretation by the framework
doReadPage
protected abstract void doReadPage()
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 itemIndex) 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>
- 参数:
itemIndex
- index of item (0 based) to jump to.- 抛出:
java.lang.Exception
- Allows subclasses to throw checked exceptions for interpretation by the framework
doJumpToPage
protected abstract void doJumpToPage(int itemIndex)