|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.hermit.android.provider.TableSchema
public abstract class TableSchema
Class encapsulating the schema for a table within a content provider. Applications must subclass this, and provide the necessary information in the call to this base class's constructor.
An application's subclass will typically provide the following:
public static final Uri CONTENT_URI
field, defining
the content URI for the table.
public static final String SORT_ORDER
field, defining
the default sort clause for the table.
public static final String
field defining the column's database name.
public static final String[] PROJECTION
field, defining
the default projection for the table.
Constructor Summary | |
---|---|
protected |
TableSchema(java.lang.String name,
java.lang.String type,
Uri uri,
java.lang.String sort,
java.lang.String[][] fields)
Create a table schema instance. |
Method Summary | |
---|---|
Uri |
getContentUri()
Get the table's content URI. |
java.lang.String |
getItemType()
Get the MIME type for the items in the table. |
java.lang.String |
getTableName()
Get the table name. |
java.lang.String |
getTableType()
Get the MIME type for the table as a whole. |
protected static java.lang.String[] |
makeProjection(java.lang.String[][] fields)
This method creates a projection from a set of field definitions. |
void |
onInsert(ContentValues values)
This method is called when a new row is added into this table. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
protected TableSchema(java.lang.String name, java.lang.String type, Uri uri, java.lang.String sort, java.lang.String[][] fields)
name
- Name for the table; e.g. "points".type
- Base MIME type identifying the content of this
table; e.g. "vnd.hermit.org.passage.point".uri
- Content URI for this table.sort
- Default sort order for this table; e.g.
"time ASC".fields
- List of field definitions. Each one is two
strings, being the field name and type. E.g.
{ { "name", "TEXT" }, { "time", "INTEGER" }}.
The standard ID field "_id" will be prepended
automatically.Method Detail |
---|
protected static java.lang.String[] makeProjection(java.lang.String[][] fields)
fields
- List of field definitions. Each one is two
strings, being the field name and type. E.g.
{ { "name", "TEXT" }, { "time", "INTEGER" }}.
The standard ID field "_id" will be prepended
automatically.
public java.lang.String getTableName()
public Uri getContentUri()
public java.lang.String getTableType()
public java.lang.String getItemType()
public void onInsert(ContentValues values)
values
- The fields being added.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |