|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectvelosurf.context.RowIterator
public class RowIterator
This class is a context wrapper for ResultSets, and provides an iteration mecanism for #foreach loops, as long as getters for values of the current row.
| Field Summary | |
|---|---|
private PooledStatement |
pooledStatement
Source statement. |
private boolean |
prefetch
whether we did prefetch a row |
private Entity |
resultEntity
Resulting entity. |
private java.sql.ResultSet |
resultSet
Wrapped result set. |
| Constructor Summary | |
|---|---|
RowIterator(PooledStatement pooledStatement,
java.sql.ResultSet resultSet,
Entity resultEntity)
Build a new RowIterator. |
|
| Method Summary | |
|---|---|
private boolean |
dataAvailable()
Check if some data is available. |
java.lang.Object |
get(java.lang.Object key)
Generic getter for values of the current row. |
java.util.List<Instance> |
getRows()
Gets all the rows in a list of instances. |
boolean |
hasNext()
Returns true if the iteration has more elements. |
java.util.Set<java.lang.String> |
keySet()
Get keys set. |
java.lang.Object |
next()
Returns the next element in the iteration. |
void |
remove()
not implemented. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
private PooledStatement pooledStatement
private java.sql.ResultSet resultSet
private Entity resultEntity
private boolean prefetch
| Constructor Detail |
|---|
public RowIterator(PooledStatement pooledStatement,
java.sql.ResultSet resultSet,
Entity resultEntity)
pooledStatement - the sql statementresultSet - the resultsetresultEntity - the resulting entity (may be null)| Method Detail |
|---|
public boolean hasNext()
hasNext in interface java.util.Iteratortrue if the iterator has more elements.public java.lang.Object next()
next in interface java.util.Iteratorpublic void remove()
remove in interface java.util.Iteratorpublic java.lang.Object get(java.lang.Object key)
get in interface RowHandlerkey - the name of an existing column or attribute
public java.util.List<Instance> getRows()
public java.util.Set<java.lang.String> keySet()
RowHandler
keySet in interface RowHandler
private boolean dataAvailable()
throws java.sql.SQLException
true if some data is available (ie the internal
ResultSet is not empty, and not before first row neither after last
one)
java.sql.SQLException - if the internal ResultSet is not happy
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||