|
|||||||
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>
public class IteratorResultHandler<T> extends Object implements ResultHandler<ResultIterator<T>>
An implementation of ResultHandler
that can be specified to cause pureQuery to return content 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 IteratorResultHandler<T>
require the user to specify 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 IteratorResultHandler<T>
maintains no state information other than the format in which the ResultIterator<T>
returns each row. Therefore, a single instance of IteratorResultHandler<T>
can be used for more than one pureQuery method.
Constructor and Description |
---|
IteratorResultHandler(Class<T> beanClass) Constructs an instance of IteratorResultHandler<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 SQL query results as instances of the class beanClass . |
IteratorResultHandler(RowHandler<T> singleRowHandler) Constructs an instance of IteratorResultHandler<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 SQL query results. |
Modifier and Type | Method and Description |
---|---|
ResultIterator<T> |
handle(ResultSet resultSet) Returns an instance of ResultIterator that can be used to return each row of resultSet in the specified format. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
public IteratorResultHandler(Class<T> beanClass)
IteratorResultHandler<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 SQL query results as instances of the class beanClass
.
beanClass
- the Class
in which to return content of each row of the SQL query resultspublic IteratorResultHandler(RowHandler<T> singleRowHandler)
IteratorResultHandler<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 SQL query results.
singleRowHandler
- the instance of an implementation of RowHandler
that is used to process each row of the SQL query resultspublic ResultIterator<T> handle(ResultSet resultSet)
ResultIterator
that can be used to return each row of resultSet
in the specified format. (The format to be used for each row was specified when the constructor was called.) When an IteratorResultHandler<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>>
resultSet
- a ResultSet
that represents the results from an SQL statementResultIterator
that can be used to return each row of resultSet
in the specified format. (The format to be used for each row was specified when the constructor was 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 |