org.apache.jdo.query
Class BasicQueryResult.BasicQueryResultIterator

java.lang.Object
  extended byorg.apache.jdo.query.BasicQueryResult.BasicQueryResultIterator
All Implemented Interfaces:
java.util.Iterator, QueryResultIterator
Enclosing class:
BasicQueryResult

public class BasicQueryResult.BasicQueryResultIterator
extends java.lang.Object
implements QueryResultIterator

The internal query result iterator supports all iterator methods plus close, allowing early release of resources.


Field Summary
(package private)  boolean closed
          The flag indicating whether the query result is closed.
(package private)  java.util.Iterator internalIterator
          The internal iterator over the query results.
 
Constructor Summary
private BasicQueryResult.BasicQueryResultIterator(java.util.Iterator it)
          Construct a new query result iterator given the iterator over the results.
 
Method Summary
 void close()
          Close this iterator and release any resources held.
 boolean hasNext()
          Return true if this query result iterator has not been closed and the internal iterator has more elements.
 boolean isClosed()
          Return true if the user has closed this iterator.
 java.lang.Object next()
          Advance and return the next element of the iterator.
 void remove()
          Throw an exception.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

internalIterator

java.util.Iterator internalIterator
The internal iterator over the query results.


closed

boolean closed
The flag indicating whether the query result is closed. If the query result is closed, no further operations can be done on it.

Constructor Detail

BasicQueryResult.BasicQueryResultIterator

private BasicQueryResult.BasicQueryResultIterator(java.util.Iterator it)
Construct a new query result iterator given the iterator over the results.

Parameters:
it - The iterator over the results of the query.
Method Detail

hasNext

public boolean hasNext()
Return true if this query result iterator has not been closed and the internal iterator has more elements.

Specified by:
hasNext in interface java.util.Iterator
Returns:
true if there are more elements.

next

public java.lang.Object next()
Advance and return the next element of the iterator.

Specified by:
next in interface java.util.Iterator
Returns:
the next element of the iterator.

close

public void close()
Close this iterator and release any resources held. After this method completes, the iterator will return false to hasNext(), and will throw NoSuchElementException to next().

Specified by:
close in interface QueryResultIterator

remove

public void remove()
Throw an exception. This iterator is read-only.

Specified by:
remove in interface java.util.Iterator

isClosed

public boolean isClosed()
Return true if the user has closed this iterator.

Returns:
true if the user has closed this iterator.