|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.apache.commons.dbutils.ResultSetIterator
public class ResultSetIterator
Wraps a ResultSet in an Iterator. This is useful
when you want to present a non-database application layer with domain
neutral data.
This implementation requires the ResultSet.isLast() method
to be implemented.
| Constructor Summary | |
|---|---|
ResultSetIterator(ResultSet rs)
Constructor for ResultSetIterator. |
|
ResultSetIterator(ResultSet rs,
RowProcessor convert)
Constructor for ResultSetIterator. |
|
| Method Summary | |
|---|---|
boolean |
hasNext()
Returns true if there are more rows in the ResultSet. |
static Iterable<Object[]> |
iterable(ResultSet rs)
Generates an Iterable, suitable for use in for-each loops. |
Object[] |
next()
Returns the next row as an Object[]. |
void |
remove()
Deletes the current row from the ResultSet. |
protected void |
rethrow(SQLException e)
Rethrow the SQLException as a RuntimeException. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public ResultSetIterator(ResultSet rs)
rs - Wrap this ResultSet in an Iterator.
public ResultSetIterator(ResultSet rs,
RowProcessor convert)
rs - Wrap this ResultSet in an Iterator.convert - The processor to use when converting a row into an
Object[]. Defaults to a
BasicRowProcessor.| Method Detail |
|---|
public boolean hasNext()
hasNext in interface Iterator<Object[]>true if there are more rows
RuntimeException - if an SQLException occurs.public Object[] next()
Object[].
next in interface Iterator<Object[]>Object[] with the same number of elements as
columns in the ResultSet.
RuntimeException - if an SQLException occurs.Iterator.next()public void remove()
ResultSet.
remove in interface Iterator<Object[]>RuntimeException - if an SQLException occurs.Iterator.remove()protected void rethrow(SQLException e)
e - SQLException to rethrowpublic static Iterable<Object[]> iterable(ResultSet rs)
Iterable, suitable for use in for-each loops.
rs - Wrap this ResultSet in an Iterator.
Iterable, suitable for use in for-each loops.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||