metagloss 0.0.2

net.sf.metagloss.db
Class DBUtils

java.lang.Object
  extended by net.sf.metagloss.db.DBUtils

public class DBUtils
extends java.lang.Object

Utility class for working with databases and building ContentValues from classes annotated with CursorBind.


Field Summary
static boolean debug
          If set to true, buildContentValues methods prints the parsed values.
 
Method Summary
static android.content.ContentValues buildContentValues(android.content.ContentValues contentValues, java.lang.Object object)
          Populate an instance of ContentValues from an object annotated with CursorBind.
static android.content.ContentValues buildContentValues(java.lang.Object object)
          Populate an instance of ContentValues from an object annotated with CursorBind.
static
<T extends java.lang.Enum<? extends ITable>>
java.lang.String[]
getColumns(java.lang.Class<T> table)
          Gets all columns from a table.
static java.lang.String getTableName(java.lang.Class<? extends java.lang.Enum<? extends ITable>> table)
          Gets the name of a database table by querying an ITable enum.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

debug

public static boolean debug
If set to true, buildContentValues methods prints the parsed values.

Method Detail

buildContentValues

public static android.content.ContentValues buildContentValues(java.lang.Object object)
Populate an instance of ContentValues from an object annotated with CursorBind.

Parameters:
object - Object to inject.
Returns:
Content values matching object.

buildContentValues

public static android.content.ContentValues buildContentValues(android.content.ContentValues contentValues,
                                                               java.lang.Object object)
Populate an instance of ContentValues from an object annotated with CursorBind.

Parameters:
contentValues - If not null, will add values to the supplied ContentValues.
object - Object to inject.
Returns:
Content values matching object.

getColumns

public static <T extends java.lang.Enum<? extends ITable>> java.lang.String[] getColumns(java.lang.Class<T> table)
Gets all columns from a table.

Parameters:
table - Table to extract columns from.
Returns:
All columns in table.

getTableName

public static java.lang.String getTableName(java.lang.Class<? extends java.lang.Enum<? extends ITable>> table)
Gets the name of a database table by querying an ITable enum.

Parameters:
table - Table from which to get the name.
Returns:
Name of database table.