com.todoroo.andlib.data
Class TodorooCursor<TYPE extends AbstractModel>

java.lang.Object
  extended by android.database.CursorWrapper
      extended by com.todoroo.andlib.data.TodorooCursor<TYPE>
Type Parameters:
TYPE - a model type that is returned by this cursor
All Implemented Interfaces:
android.database.Cursor

public class TodorooCursor<TYPE extends AbstractModel>
extends android.database.CursorWrapper

AstridCursor wraps a cursor and allows users to query for individual Property types or read an entire AbstractModel from a database row.

Author:
Tim Su

Nested Class Summary
static class TodorooCursor.CursorReadingVisitor
          Visitor that reads the given property from a cursor
 
Constructor Summary
TodorooCursor(android.database.Cursor cursor, Property<?>[] properties)
          Create an AstridCursor from the supplied Cursor object.
 
Method Summary
<PROPERTY_TYPE>
PROPERTY_TYPE
get(Property<PROPERTY_TYPE> property)
          Get the value for the given property on the underlying Cursor
 int getColumnIndexFromCache(java.lang.String field)
          Use cache to get the column index for the given field name
 Property<?>[] getProperties()
          Gets entire property list
 
Methods inherited from class android.database.CursorWrapper
close, copyStringToBuffer, deactivate, getBlob, getColumnCount, getColumnIndex, getColumnIndexOrThrow, getColumnName, getColumnNames, getCount, getDouble, getExtras, getFloat, getInt, getLong, getPosition, getShort, getString, getWantsAllOnMoveCalls, isAfterLast, isBeforeFirst, isClosed, isFirst, isLast, isNull, move, moveToFirst, moveToLast, moveToNext, moveToPosition, moveToPrevious, registerContentObserver, registerDataSetObserver, requery, respond, setNotificationUri, unregisterContentObserver, unregisterDataSetObserver
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TodorooCursor

public TodorooCursor(android.database.Cursor cursor,
                     Property<?>[] properties)
Create an AstridCursor from the supplied Cursor object.

Parameters:
cursor -
properties - properties read from this cursor
Method Detail

get

public <PROPERTY_TYPE> PROPERTY_TYPE get(Property<PROPERTY_TYPE> property)
Get the value for the given property on the underlying Cursor

Type Parameters:
PROPERTY_TYPE - type to return
Parameters:
property - to retrieve
Returns:

getProperties

public Property<?>[] getProperties()
Gets entire property list

Returns:

getColumnIndexFromCache

public int getColumnIndexFromCache(java.lang.String field)
Use cache to get the column index for the given field name