Package org.apache.cayenne
Interface ResultIterator<T>
- All Superinterfaces:
- AutoCloseable,- Iterable<T>
- All Known Implementing Classes:
- ConnectionAwareResultIterator,- DistinctResultIterator,- JDBCResultIterator,- LimitResultIterator
public interface ResultIterator<T> extends Iterable<T>, AutoCloseable
Defines API of an iterator over the records returned as a result of
 Select queries execution. Usually a ResultIterator is supported by an open
 java.sql.ResultSet, therefore ResultIterators must be explicitly closed when
 the user is done working with them. An alternative to that is
 
ObjectContext.iterate(org.apache.cayenne.query.Select, ResultIteratorCallback)
 method that handles resource management.- Since:
- 3.0
- 
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.booleanhasNextRow()Returns true if there is at least one more record that can be read from the 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 interface java.lang.IterableforEach, iterator, spliterator
- 
Method Details- 
allRowsReturns all yet unread rows from ResultSet without closing it.- Since:
- 3.0
 
- 
hasNextRowboolean hasNextRow()Returns true if there is at least one more record that can be read from the iterator.
- 
nextRowT nextRow()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.- Since:
- 3.0
 
- 
skipRowvoid skipRow()Goes past current row. If the row is not needed, this may save some time on data conversion.- Since:
- 3.0
 
- 
closevoid close()Closes 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
 
 
-