|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.j256.ormlite.stmt.SelectIterator<T,ID>
T - The class that the code will be operating on.ID - The class of the ID column associated with the class. The T class does not require an ID field. The class
needs an ID parameter however so you can use Void or Object to satisfy the compiler.public class SelectIterator<T,ID>
Internal iterator so we can page through the class. This is used by the Dao.iterator() methods.
| Constructor Summary | |
|---|---|
SelectIterator(Class<?> dataClass,
Dao<T,ID> classDao,
GenericRowMapper<T> rowMapper,
ConnectionSource connectionSource,
DatabaseConnection connection,
CompiledStatement compiledStmt,
String statement,
ObjectCache objectCache)
If the statement parameter is null then this won't log information |
|
| Method Summary | |
|---|---|
void |
close()
Close any underlying SQL statements. |
void |
closeQuietly()
Close any underlying SQL statements but swallow any SQLExceptions. |
T |
current()
Return the current result object that we have accessed or null if none. |
T |
first()
Move to the first result and return it or null if none. |
DatabaseResults |
getRawResults()
Return the underlying database results object if any. |
boolean |
hasNext()
Returns whether or not there are any remaining objects in the table. |
boolean |
hasNextThrow()
Returns whether or not there are any remaining objects in the table. |
T |
moveRelative(int offset)
Move a relative position in the list and return that result or null if none. |
void |
moveToNext()
Move to the next item in the iterator without calling Iterator.next(). |
T |
next()
Returns the next object in the table. |
T |
nextThrow()
Returns the Iterator.next() object in the table or null if none. |
T |
previous()
Moves to the previous result and return it or null if none. |
void |
remove()
Removes the last object returned by next() by calling delete on the dao associated with the object. |
void |
removeThrow()
Removes the last object returned by next() by calling delete on the dao associated with the object. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public SelectIterator(Class<?> dataClass,
Dao<T,ID> classDao,
GenericRowMapper<T> rowMapper,
ConnectionSource connectionSource,
DatabaseConnection connection,
CompiledStatement compiledStmt,
String statement,
ObjectCache objectCache)
throws SQLException
SQLException| Method Detail |
|---|
public boolean hasNextThrow()
throws SQLException
SQLException - If there was a problem getting more results via SQL.public boolean hasNext()
hasNext in interface Iterator<T>IllegalStateException - If there was a problem getting more results via SQL.
public T first()
throws SQLException
CloseableIterator
first in interface CloseableIterator<T>SQLException
public T previous()
throws SQLException
CloseableIterator
previous in interface CloseableIterator<T>SQLException
public T current()
throws SQLException
CloseableIterator
current in interface CloseableIterator<T>SQLException
public T nextThrow()
throws SQLException
CloseableIteratorIterator.next() object in the table or null if none.
nextThrow in interface CloseableIterator<T>SQLException - Throws a SQLException on error since Iterator.next() cannot throw because it is part of the
Iterator definition. It will not throw if there is no next.public T next()
next in interface Iterator<T>IllegalStateException - If there was a problem extracting the object from SQL.
public T moveRelative(int offset)
throws SQLException
CloseableIteratorIterator.next().
moveRelative(-1) is the same as CloseableIterator.previous() result. This may not work with the default iterator depending
on your database.
moveRelative in interface CloseableIterator<T>offset - Number of rows to move. Positive moves forward in the results. Negative moves backwards.
SQLException
public void removeThrow()
throws SQLException
IllegalStateException - If there was no previous next() call.
SQLException - If the delete failed.public void remove()
remove in interface Iterator<T>IllegalStateException - If there was no previous next() call or if delete() throws a SQLException (set as the cause).
public void close()
throws SQLException
CloseableIterator
close in interface CloseableIterator<T>SQLExceptionpublic void closeQuietly()
CloseableIterator
closeQuietly in interface CloseableIterator<T>public DatabaseResults getRawResults()
CloseableIterator
getRawResults in interface CloseableIterator<T>public void moveToNext()
CloseableIteratorIterator.next().
moveToNext in interface CloseableIterator<T>
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||