metagloss 0.0.2

Class AssistCursor<T extends java.lang.Enum<T> & ITable>

  extended by net.sf.metagloss.db.AssistCursor<T>
Type Parameters:
T - The table to work on.
All Implemented Interfaces:

public class AssistCursor<T extends java.lang.Enum<T> & ITable>
extends java.lang.Object
implements Injector

A partial wrapper for the Cursor class, offering annotation-based setter injection and automatic translation of column ids for SQL SELECT queries. Additionally provides convenience methods for retrieving relevant data from the supplied Cursor object.

The class is designed to only work on queries made on single tables.

See Also:
CursorBind, ITable

Constructor Summary
AssistCursor(java.lang.Class<T> table, android.database.Cursor cursor)
          Creates a new AssistCursor.
Method Summary
 double getDouble(T column)
 float getFloat(T column)
 int getInt(T column)
 long getLong(T column)
 java.lang.String getString(T column)
 void inject(java.lang.Object data)
          Injects the setters of the object to which the cursor relates.
 boolean next()
          Moves to the next row in the result set.
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Constructor Detail


public AssistCursor(java.lang.Class<T> table,
                    android.database.Cursor cursor)
Creates a new AssistCursor. The database columns are matched against the column layout within the Cursor object upon instantiation.

table - The database table to work on.
cursor - Cursor associated with a query on the supplied table.
Method Detail


public double getDouble(T column)


public float getFloat(T column)


public int getInt(T column)


public long getLong(T column)


public java.lang.String getString(T column)


public void inject(java.lang.Object data)
Injects the setters of the object to which the cursor relates. It is possible to inject several objects of different classes with subsequent calls, as long as they are properly annotated.

In order to make a setter eligible for injection, it must satisfy the following requirements:

  1. Field or Method annotated with CursorBind
  2. Public visibility on setter
  3. Single parameter argument
  4. Prefixed with set.


Even if the desired field is annotated with CursorBind, the appropriate setter method is still required.

Specified by:
inject in interface Injector
data - Object to be injected.


public boolean next()
Moves to the next row in the result set. Will throw an InjectionException if any subsequent calls are made this this method after returning false.

Specified by:
next in interface Injector
True if the move was within the result set range.