|
||||||||||
| 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 | |
|---|---|
(package private) java.util.Set |
cachedSet
|
private boolean |
isOver
whether we reached the end |
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. |
java.util.List |
getScalars()
|
boolean |
hasNext()
Returns true if the iteration has more elements. |
java.util.List<java.lang.String> |
keyList()
|
java.util.Set<java.lang.String> |
keySet()
Get keys set. |
Instance |
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 |
|---|
java.util.Set cachedSet
private PooledStatement pooledStatement
private java.sql.ResultSet resultSet
private Entity resultEntity
private boolean prefetch
private boolean isOver
| 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.Iterator<Instance>true if the iterator has more elements.public Instance next()
next in interface java.util.Iterator<Instance>public void remove()
remove in interface java.util.Iterator<Instance>public 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.List getScalars()
public java.util.Set<java.lang.String> keySet()
RowHandler
keySet in interface RowHandlerpublic java.util.List<java.lang.String> keyList()
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 | |||||||||