org.apache.cayenne
Interface ResultIterator<T>

All Superinterfaces:
Iterable<T>, ResultIterator<T>

public interface ResultIterator<T>
extends ResultIterator<T>, Iterable<T>

Defines API of an iterator over the records returned as a result of SelectQuery execution. Usually a ResultIterator is supported by an open java.sql.ResultSet, therefore most of the methods would throw checked exceptions. ResultIterators must be explicitly closed when the user is done working with them.

Result "rows", depending on the query, may be represented as scalar values, DataRows, or Object[] arrays containing a mix of scalars and DataRows.


Method Summary
 List<T> allRows()
          Returns all yet unread rows from ResultSet without closing it.
 void close()
          Closes ResultIterator and associated ResultSet.
 boolean hasNextRow()
          Returns true if there is at least one more record that can be read from the iterator.
 T 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.
 void skipRow()
          Goes past current row.
 
Methods inherited from interface java.lang.Iterable
iterator
 

Method Detail

allRows

List<T> allRows()
Returns all yet unread rows from ResultSet without closing it.

Specified by:
allRows in interface ResultIterator<T>
Since:
3.0

hasNextRow

boolean hasNextRow()
Returns true if there is at least one more record that can be read from the iterator.

Specified by:
hasNextRow in interface ResultIterator<T>

nextRow

T 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.

Specified by:
nextRow in interface ResultIterator<T>
Since:
3.0

skipRow

void skipRow()
Goes past current row. If the row is not needed, this may save some time on data conversion.

Specified by:
skipRow in interface ResultIterator<T>
Since:
3.0

close

void 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:
close in interface ResultIterator<T>


Copyright © 2001-2013 Apache Cayenne. All Rights Reserved.