|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.deegree.commons.jdbc.ResultSetIterator<T>
T
- type of the iterated objectspublic abstract class ResultSetIterator<T>
Abstract base class for easy implementation of CloseableIterator
s 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 null
conn
- connection that was used to obtain the result set, must not be null
stmt
- 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()
CloseableIterator
List
and closes the iterator.
NOTE: This should only be used for small numbers of elements.
getAsListAndClose
in interface CloseableIterator<T>
null
public Collection<T> getAsCollectionAndClose(Collection<T> collection)
CloseableIterator
Collection
and closes the iterator.
getAsCollectionAndClose
in interface CloseableIterator<T>
collection
- collection where the elements are copied, must not be null
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |