|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.ibm.pdq.runtime.data.handlers.IteratorResultHandler<T>
com.ibm.pdq.runtime.data.handlers.IteratorPagingResultHandler<T>
public class IteratorPagingResultHandler<T>
An implementation of ResultHandler
that can be specified to cause pureQuery to return content of a specified page of the results of an SQL query as an instance of ResultIterator
. The rows are returned by the
ResultIterator<T>
in the same order in which they are returned from the data source. See ResultHandler
for a description of how an implementation of ResultHandler
can be specified to a pureQuery method.
The constructors of IteratorPagingResultHandler<T>
require the user to specify which page of the SQL query results to return and the format in which to return each row of
the results. One way to specify the format is by providing a class. If a class is provided, pureQuery creates an instance of that class to contain each row of the results. The format also can be
specified by providing an instance of an implementation of RowHandler
to use to process each row of the results. <T>
is the generic type of the RowHandler
or the
Class
that is specified to a constructor, and it is the generic type of the returned ResultIterator<T>
.
An instance of IteratorPagingResultHandler<T>
maintains no state information other than which page to process and the format in which the
ResultIterator<T>
returns each row. Therefore, a single instance of IteratorPagingResultHandler<T>
can be used for more than one pureQuery method.
Constructor and Description | |
---|---|
IteratorPagingResultHandler(Class<T> beanClass, int absoluteStartingRow, int absoluteEndingRow) Constructs an instance of IteratorPagingResultHandler<T> that can be provided to a pureQuery method so that the method returns an instance of ResultIterator that returns content of the rows of the specified page
of the SQL query results as instances of the class beanClass . |
|
IteratorPagingResultHandler(int
pageNumber, int pageSize, Class<T> beanClass) Constructs an instance of IteratorPagingResultHandler<T> that can be provided to a pureQuery method so that the method returns an instance of ResultIterator that returns content of the rows of the specified page
of the SQL query results as instances of the class beanClass . |
|
IteratorPagingResultHandler(int
pageNumber, int pageSize, RowHandler<T> singleRowHandler) Constructs an instance of IteratorPagingResultHandler<T> that can be provided to a pureQuery method so that the method returns an instance of ResultIterator that uses singleRowHandler to process and
to return each row of the specified page of the SQL query results. |
|
IteratorPagingResultHandler(RowHandler<T> singleRowHandler, int absoluteStartingRow, int absoluteEndingRow) Constructs an instance of IteratorPagingResultHandler<T> that can be provided to a pureQuery method so that the method returns an instance of ResultIterator that uses the singleRowHandler to process
and to return each row of the specified page of the SQL query results. |
Return Data Type | Method Name and Description |
---|---|
ResultIterator<T> |
handle(ResultSet resultSet) Returns an instance of ResultIterator that can be
used to return each row of the specified page of resultSet in the specified format. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public IteratorPagingResultHandler(Class<T> beanClass, int absoluteStartingRow, int absoluteEndingRow)
IteratorPagingResultHandler<T>
that can be provided to a pureQuery method so that the method returns an instance of ResultIterator
that returns content of the rows of the specified page
of the SQL query results as instances of the class beanClass
.
This constructor allows the page that is to be processed to be specified by indicating the range of rows on the page. absoluteStartingRow
is the number of the first row to
process, and absoluteEndingRow
is the number of the last row to process. The first row of the SQL query results is row number 1. The values of
absoluteStartingRow
and absoluteEndingRow
must both be at least 1, and absoluteStartingRow
must be less than or equal to
absoluteEndingRow
, or a RuntimeException
is thrown.
beanClass
- the Class
in which to return content of each row on the page of the SQL query resultsabsoluteStartingRow
- the row number of the first row to process on the page of the SQL query results. absoluteStartingRow
must be greater than or equal
to 1, and absoluteStartingRow
must be less than or equal to absoluteEndingRow
.absoluteEndingRow
- the row number of the last row to process on the page of the SQL query results. absoluteEndingRow
must be greater than or equal to 1,
and absoluteEndingRow
must be greater than or equal to absoluteStartingRow
.public IteratorPagingResultHandler(int pageNumber, int pageSize, Class<T> beanClass)
IteratorPagingResultHandler<T>
that can be provided to a pureQuery method so that the method returns an instance of ResultIterator
that returns content of the rows of the specified page
of the SQL query results as instances of the class beanClass
.
This constructor allows the page that is to be processed to be specified by indicating the page number and the page size. The page number for the first page of the results is 1. The
page size is the number of rows on the page. The page size must be at least 1. A RuntimeException
is thrown if pageNumber
and pageSize
are not both 1 or greater.
pageNumber
- the number that indicates the page of the SQL query results to process. pageNumber
must be greater than or equal to 1.pageSize
- the number of rows on one page of the SQL query results. pageSize
must be greater than or equal to 1.beanClass
- the Class
in which to return content of each row on the page of the SQL query resultspublic IteratorPagingResultHandler(int pageNumber, int pageSize, RowHandler<T> singleRowHandler)
IteratorPagingResultHandler<T>
that can be provided to a pureQuery method so that the method returns an instance of ResultIterator
that uses singleRowHandler
to process and
to return each row of the specified page of the SQL query results.
This constructor allows the page that is to be processed to be specified by indicating the page number and the page size. The page number for the first page of the results is 1. The
page size is the number of rows on the page. The page size must be at least 1. A RuntimeException
is thrown if pageNumber
and pageSize
are not both 1 or greater.
pageNumber
- the number that indicates the page of the SQL query results to process. pageNumber
must be greater than or equal to 1.pageSize
- the number of rows on one page of the SQL query results. pageSize
must be greater than or equal to 1.singleRowHandler
- the instance of an implementation of a RowHandler
that is used to process each row on a page of the SQL query resultspublic IteratorPagingResultHandler(RowHandler<T> singleRowHandler, int absoluteStartingRow, int absoluteEndingRow)
IteratorPagingResultHandler<T>
that can be provided to a pureQuery method so that the method returns an instance of ResultIterator
that uses the singleRowHandler
to process
and to return each row of the specified page of the SQL query results.
This constructor allows the page that is to be processed to be specified by indicating the range of rows on the page. absoluteStartingRow
is the number of the first row to
process, and absoluteEndingRow
is the number of the last row to process. The first row of the SQL query results is row number 1. The values of
absoluteStartingRow
and absoluteEndingRow
must both be at least 1, and absoluteStartingRow
must be less than or equal to
absoluteEndingRow
, or a RuntimeException
is thrown.
singleRowHandler
- the instance of an implementation of RowHandler
that is used to process each row on the page of the SQL query resultsabsoluteStartingRow
- the row number of the first row to process on the page of the SQL query results. absoluteStartingRow
must be greater than or equal
to 1, and absoluteStartingRow
must be less than or equal to absoluteEndingRow
.absoluteEndingRow
- the row number of the last row to process on the page of the SQL query results. absoluteEndingRow
must be greater than or equal to 1,
and absoluteEndingRow
must be greater than or equal to absoluteStartingRow
.Method Detail |
---|
public ResultIterator<T> handle(ResultSet resultSet)
ResultIterator
that can be used to
return each row of the specified page of resultSet
in the specified format. The page to return and the format to use for each row are specified when the constructor is
called. When an IteratorPagingResultHandler<T>
is specified for a pureQuery inline method, pureQuery calls handle(ResultSet)
to create the instance of
ResultIterator<T>
that is returned from the inline method.
<T>
is the generic type of the RowHandler
or the Class
that is specified to a constructor, and it is the generic type of the returned
ResultIterator<T>
.
handle
in interface ResultHandler<ResultIterator<T>>
handle
in class IteratorResultHandler<T>
resultSet
- a ResultSet
that
represents the results from an SQL statementResultIterator
that can be used to
return each row of the specified page of resultSet
in the specified format. The page to return and the format to use for each row are specified when the constructor is
called. <T>
is the generic type of the RowHandler
or the Class
that is specified to a constructor, and it is the generic type of the
returned ResultIterator<T>
.
|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |