Class ModelBasedResultSetIterator
java.lang.Object
edu.internet2.middleware.grouper.ext.org.apache.ddlutils.platform.ModelBasedResultSetIterator
- All Implemented Interfaces:
Iterator
This is an iterator that is specifically targeted at traversing result sets.
If the query is against a known table, then
org.apache.ddlutils.dynabean.SqlDynaBean
instances
are created from the rows, otherwise normal DynaBean
instances
are created.- Version:
- $Revision: 289996 $
-
Constructor Summary
ConstructorDescriptionModelBasedResultSetIterator
(PlatformImplBase platform, Database model, ResultSet resultSet, Table[] queryHints, boolean cleanUpAfterFinish) Creates a new iterator. -
Method Summary
Modifier and TypeMethodDescriptionvoid
advance()
Advances the iterator without materializing the object.void
cleanUp()
Closes the resources (connection, statement, resultset).protected void
finalize()
boolean
hasNext()
boolean
Determines whether the connection is still open.next()
void
remove()
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface java.util.Iterator
forEachRemaining
-
Constructor Details
-
ModelBasedResultSetIterator
public ModelBasedResultSetIterator(PlatformImplBase platform, Database model, ResultSet resultSet, Table[] queryHints, boolean cleanUpAfterFinish) throws DatabaseOperationException Creates a new iterator.- Parameters:
platform
- The platformmodel
- The database modelresultSet
- The result setqueryHints
- The tables that were queried in the query that produced the given result set (optional)cleanUpAfterFinish
- Whether to close the statement and connection after finishing the iteration, upon on exception, or when this iterator is garbage collected- Throws:
DatabaseOperationException
-
-
Method Details
-
hasNext
- Specified by:
hasNext
in interfaceIterator
- Throws:
DatabaseOperationException
-
next
- Specified by:
next
in interfaceIterator
- Throws:
DatabaseOperationException
-
advance
public void advance()Advances the iterator without materializing the object. This is the same effect as callingnext()
except that no object is created and nothing is read from the result set. -
remove
- Specified by:
remove
in interfaceIterator
- Throws:
DatabaseOperationException
-
cleanUp
public void cleanUp()Closes the resources (connection, statement, resultset). -
finalize
-
isConnectionOpen
public boolean isConnectionOpen()Determines whether the connection is still open.- Returns:
true
if the connection is still open
-