public class CursorCompartment
extends java.lang.Object
CursorCompartment is used to get or iterate results from a Cursor.
A CursorCompartment is created from Cupboard.withCursor(Cursor).
Cursor cursor = ... // get the first Book from this cursor Book book = cupboard().withCursor(cursor).get(Book.class); // iterate all books Iterableitr = cupboard().withCursor(cursor).iterate(); for (Book book : itr) { // access book }
| Modifier | Constructor and Description |
|---|---|
protected |
CursorCompartment(Cupboard cupboard,
android.database.Cursor cursor) |
| Modifier and Type | Method and Description |
|---|---|
<T> T |
get(java.lang.Class<T> clz)
Get the first entity from the cursor
|
protected <T> EntityConverter<T> |
getConverter(java.lang.Class<T> clz) |
<T> QueryResultIterable<T> |
iterate(java.lang.Class<T> clz)
Create a
Iterable of objects. |
<T> java.util.List<T> |
list(java.lang.Class<T> clz)
Get the contents of this cursor as a list, starting at the current position.
|
protected final Cupboard mCupboard
protected CursorCompartment(Cupboard cupboard, android.database.Cursor cursor)
public <T> QueryResultIterable<T> iterate(java.lang.Class<T> clz)
Iterable of objects.clz - the entity typepublic <T> T get(java.lang.Class<T> clz)
clz - the entity typepublic <T> java.util.List<T> list(java.lang.Class<T> clz)
clz - the entity typeprotected <T> EntityConverter<T> getConverter(java.lang.Class<T> clz)