Package org.apache.cayenne.access.jdbc
Class ConnectionAwareResultIterator<T>
java.lang.Object
org.apache.cayenne.access.jdbc.ConnectionAwareResultIterator<T>
- All Implemented Interfaces:
- AutoCloseable,- Iterable<T>,- ResultIterator<T>
public class ConnectionAwareResultIterator<T> extends Object implements ResultIterator<T>
A 
ResultIterator wrapper that handles closing a connection. Also
 internally counts processed rows, mostly for the benefit of subclasses.
 Subclasses are used in iterators that are returned to the end users and are
 not implicitly managed by Cayenne.- Since:
- 4.0
- 
Field SummaryFields Modifier and Type Field Description protected introwCounter
- 
Constructor SummaryConstructors Constructor Description ConnectionAwareResultIterator(ResultIterator<T> delegate, Connection connection)
- 
Method SummaryModifier and Type Method Description List<T>allRows()Returns all yet unread rows from ResultSet without closing it.voidclose()Closes ResultIterator and associated ResultSet.protected voiddoClose()booleanhasNextRow()Returns true if there is at least one more record that can be read from the iterator.Iterator<T>iterator()TnextRow()Returns the next result row that is, depending on the query, may be a scalar value, a DataRow, or an Object[] array containing a mix of scalars and DataRows.voidskipRow()Goes past current row.Methods inherited from class java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface java.lang.IterableforEach, spliterator
- 
Field Details- 
rowCounterprotected int rowCounter
 
- 
- 
Constructor Details- 
ConnectionAwareResultIterator
 
- 
- 
Method Details- 
closepublic void close()Description copied from interface:ResultIteratorCloses ResultIterator and associated ResultSet. This method must be called explicitly when the user is finished processing the records. Otherwise unused database resources will not be released properly.- Specified by:
- closein interface- AutoCloseable
- Specified by:
- closein interface- ResultIterator<T>
 
- 
doCloseprotected void doClose()
- 
allRowsDescription copied from interface:ResultIteratorReturns all yet unread rows from ResultSet without closing it.- Specified by:
- allRowsin interface- ResultIterator<T>
 
- 
hasNextRowpublic boolean hasNextRow()Description copied from interface:ResultIteratorReturns true if there is at least one more record that can be read from the iterator.- Specified by:
- hasNextRowin interface- ResultIterator<T>
 
- 
nextRowDescription copied from interface:ResultIteratorReturns the next result row that is, depending on the query, may be a scalar value, a DataRow, or an Object[] array containing a mix of scalars and DataRows.- Specified by:
- nextRowin interface- ResultIterator<T>
 
- 
iterator
- 
skipRowpublic void skipRow()Description copied from interface:ResultIteratorGoes past current row. If the row is not needed, this may save some time on data conversion.- Specified by:
- skipRowin interface- ResultIterator<T>
 
 
-