|
deegree-core-3.0-pre-nightly (2010/03/05 00:01) - official | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.deegree.commons.jdbc.ResultSetIterator<T>
T - type of the iterated objectspublic abstract class ResultSetIterator<T>
Abstract base class for easy implementation of CloseableIterators that are backed by an SQL result set.
| Constructor Summary | |
|---|---|
protected |
ResultSetIterator(ResultSet rs,
Connection conn,
Statement stmt)
Creates a new ResultSetIterator instance. |
| Method Summary | |
|---|---|
void |
close()
Frees all underlying resources, no other method calls are permitted after calling this. |
protected abstract T |
createElement(ResultSet rs)
Invoked to create the next element in the iteration sequence from the ResultSet (usually from one row). |
Collection<T> |
getAsCollectionAndClose(Collection<T> collection)
Copies the elements into the given Collection and closes the iterator. |
List<T> |
getAsListAndClose()
Returns the elements as an easy accessible List and closes the iterator. |
boolean |
hasNext()
|
T |
next()
|
void |
remove()
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
protected ResultSetIterator(ResultSet rs,
Connection conn,
Statement stmt)
ResultSetIterator instance.
rs - result set that the iterator uses to build the elements, must not be nullconn - connection that was used to obtain the result set, must not be nullstmt - statement that was used to obtain the result set, must not be null| Method Detail |
|---|
public void close()
CloseableIterator
close in interface CloseableIterator<T>public boolean hasNext()
hasNext in interface Iterator<T>public T next()
next in interface Iterator<T>
protected abstract T createElement(ResultSet rs)
throws SQLException
ResultSet (usually from one row).
rs - result set that is used to build the element, this is never null
SQLException - if the accessing of the result set or element creation failspublic void remove()
remove in interface Iterator<T>public List<T> getAsListAndClose()
CloseableIteratorList and closes the iterator.
NOTE: This should only be used for small numbers of elements.
getAsListAndClose in interface CloseableIterator<T>nullpublic Collection<T> getAsCollectionAndClose(Collection<T> collection)
CloseableIteratorCollection and closes the iterator.
getAsCollectionAndClose in interface CloseableIterator<T>collection - collection where the elements are copied, must not be null
|
deegree-core-3.0-pre-nightly (2010/03/05 00:01) - official | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||