T
- Type of item to be readpublic abstract class AbstractPaginatedDataItemReader<T> extends AbstractItemCountingItemStreamItemReader<T>
Modifier and Type | Field and Description |
---|---|
protected int |
page |
protected int |
pageSize |
protected java.util.Iterator<T> |
results |
Constructor and Description |
---|
AbstractPaginatedDataItemReader() |
Modifier and Type | Method and Description |
---|---|
protected void |
doClose()
Close the resources opened in
AbstractItemCountingItemStreamItemReader.doOpen() . |
protected void |
doOpen()
Open resources necessary to start reading input.
|
protected abstract java.util.Iterator<T> |
doPageRead()
Method this
ItemStreamReader delegates to
for the actual work of reading a page. |
protected T |
doRead()
Read next item from input.
|
protected void |
jumpToItem(int itemLastIndex)
Move to the given item index.
|
void |
setPageSize(int pageSize)
The number of items to be read with each page.
|
close, getCurrentItemCount, isSaveState, open, read, setCurrentItemCount, setMaxItemCount, setSaveState, update
getExecutionContextKey, setExecutionContextName, setName
protected volatile int page
protected int pageSize
protected java.util.Iterator<T> results
public void setPageSize(int pageSize)
pageSize
- the number of items. pageSize must be greater than zero.protected T doRead() throws java.lang.Exception
AbstractItemCountingItemStreamItemReader
doRead
in class AbstractItemCountingItemStreamItemReader<T>
java.lang.Exception
- Allows subclasses to throw checked exceptions for interpretation by the frameworkprotected abstract java.util.Iterator<T> doPageRead()
ItemStreamReader
delegates to
for the actual work of reading a page. Each time
this method is called, the resulting Iterator
should contain the items read within the next page.
Iterator
is empty or null when it is
returned, this ItemReader
will assume that the
input has been exhausted.Iterator
containing the items within a page.protected void doOpen() throws java.lang.Exception
AbstractItemCountingItemStreamItemReader
doOpen
in class AbstractItemCountingItemStreamItemReader<T>
java.lang.Exception
- Allows subclasses to throw checked exceptions for interpretation by the frameworkprotected void doClose() throws java.lang.Exception
AbstractItemCountingItemStreamItemReader
AbstractItemCountingItemStreamItemReader.doOpen()
.doClose
in class AbstractItemCountingItemStreamItemReader<T>
java.lang.Exception
- Allows subclasses to throw checked exceptions for interpretation by the frameworkprotected void jumpToItem(int itemLastIndex) throws java.lang.Exception
AbstractItemCountingItemStreamItemReader
AbstractItemCountingItemStreamItemReader.doRead()
.jumpToItem
in class 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