org.modelsphere.jack.baseDb.db
Interface DbEnumeration


public interface DbEnumeration

This interface allows to implements enumerators that need to be closed.

This interface defines the following behavior on nextElement:

nextElement() may be called only after a successful call to hasMoreElements(), and will return exactly the element retrieved by hasMoreElements(); nextElement() increments the cursor, which allows the next call to hasMoreElements() to retrieve a further element. So two consecutive calls to hasMoreElements() will retrieve the same element (cursor not updated); two consecutive calls to nextElement() will throw a RuntimeException on the second call.


Method Summary
 void close()
          Close the enumeration.
 boolean hasMoreElements()
           
 DbObject nextElement()
           
 

Method Detail

hasMoreElements

boolean hasMoreElements()
                        throws DbException
Returns:
true if more elements are available in the enumeration, false otherwise.
Throws:
DbException - Thrown if the enumeration has been closed or if the transaction has been closed.

nextElement

DbObject nextElement()
                     throws DbException
Returns:
The next object.
Throws:
DbException - Thrown if the enumeration has been closed or if the transaction has been closed.

close

void close()
Close the enumeration. Once an enumeration has been close, any calls to hasMoreElements() or nextElement() will throws a DbException.



Open ModelSphere 2007. All Rights Reserved.