org.apache.cayenne.access.jdbc
Class CollectionResultIterator<T>

java.lang.Object
  extended by org.apache.cayenne.access.jdbc.CollectionResultIterator<T>
All Implemented Interfaces:
Iterable<T>, ResultIterator<T>

public class CollectionResultIterator<T>
extends Object
implements ResultIterator<T>

A ResultIterator over a collection of objects.

Since:
3.2

Field Summary
protected  Iterator<T> iterator
           
 
Constructor Summary
CollectionResultIterator(Collection<T> c)
           
 
Method Summary
 List<T> allRows()
          Returns all yet unread rows from ResultSet without closing it.
protected  void checkIterator()
           
 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.
 Iterator<T> 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 class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

iterator

protected Iterator<T> iterator
Constructor Detail

CollectionResultIterator

public CollectionResultIterator(Collection<T> c)
Method Detail

iterator

public Iterator<T> iterator()
Specified by:
iterator in interface Iterable<T>

allRows

public List<T> allRows()
Description copied from interface: ResultIterator
Returns all yet unread rows from ResultSet without closing it.

Specified by:
allRows in interface ResultIterator<T>

hasNextRow

public boolean hasNextRow()
Description copied from interface: ResultIterator
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

public T nextRow()
Description copied from interface: ResultIterator
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>

skipRow

public void skipRow()
Description copied from interface: ResultIterator
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>

close

public void close()
Description copied from interface: ResultIterator
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>

checkIterator

protected void checkIterator()


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