public abstract class BaseContentProvider
extends android.content.ContentProvider
BaseContentProvider is the base class of all generated ContentProvider for Entity classes.Entity which allows ContentProvider generation a separate ContentProvider will be generated. The generated
ContentProvider is also referenced in the AndroidManifest.xml to use an own Implementation remove the attribute
droitateddb:generated="true" in the provider element of the AndroidManifest.xmlContentProvider is therefore defined within the Entity annotation.Uri for calling the ContentProvider is build following this schema: content://[authority]/[
getEntityURIPart()]. getEntityURIPart() returns entityBaseContentProvider provides the methods uri(String) and
uriForItem(String, long). These methods allow getting the Uri referencing the Provider with the table name of the
Entity and the primary key. uri(String): Returns a Uri for accessing multiple Entity elements.uriForItem(String, long): Returns a Uri for accessing a specific Entity element| Modifier | Constructor and Description |
|---|---|
protected |
BaseContentProvider() |
| Modifier and Type | Method and Description |
|---|---|
int |
delete(android.net.Uri uri,
java.lang.String selection,
java.lang.String[] selectionArgs) |
protected abstract java.lang.String |
getAuthority()
Has to return the authority to be used for this
ContentProvider. |
protected abstract EntityInfo |
getEntityInfo()
Has to return metadata of the
Entity this ContentProvider is for. |
protected java.lang.String |
getEntityURIPart() |
protected abstract AbstractAttribute |
getIdAttribute()
Has to return the attribute describing the primary key of the
Entity. |
java.lang.String |
getType(android.net.Uri uri) |
android.net.Uri |
insert(android.net.Uri uri,
android.content.ContentValues values) |
boolean |
onCreate() |
android.database.Cursor |
query(android.net.Uri uri,
java.lang.String[] projection,
java.lang.String selection,
java.lang.String[] selectionArgs,
java.lang.String sortOrder) |
int |
update(android.net.Uri uri,
android.content.ContentValues values,
java.lang.String selection,
java.lang.String[] selectionArgs) |
static android.net.Uri |
uri(java.lang.String tableName)
Returns a
Uri for the using it with a ContentResolver to access this ContentProvider. |
static android.net.Uri |
uriForItem(java.lang.String tableName,
long id)
Returns a
Uri for the using it with a ContentResolver to access this ContentProvider. |
applyBatch, attachInfo, bulkInsert, call, getContext, getPathPermissions, getReadPermission, getStreamTypes, getWritePermission, isTemporary, onConfigurationChanged, onLowMemory, onTrimMemory, openAssetFile, openFile, openFileHelper, openPipeHelper, openTypedAssetFile, setPathPermissions, setReadPermission, setWritePermission, shutdownpublic static android.net.Uri uri(java.lang.String tableName)
Uri for the using it with a ContentResolver to access this ContentProvider. The Uri allows CRUD operations on
multiple Entity elements.tableName - Name of the Table (simple Entity name) the data should be retrieved from.public static android.net.Uri uriForItem(java.lang.String tableName,
long id)
Uri for the using it with a ContentResolver to access this ContentProvider. The Uri allows CRUD operations
on a
single Entity element, qualified by its primary key.protected abstract java.lang.String getAuthority()
ContentProvider.Entity classprotected abstract AbstractAttribute getIdAttribute()
Entity.PrimaryKey annotated Column.protected abstract EntityInfo getEntityInfo()
Entity this ContentProvider is for.Entity being accessedprotected java.lang.String getEntityURIPart()
public boolean onCreate()
onCreate in class android.content.ContentProviderpublic java.lang.String getType(android.net.Uri uri)
getType in class android.content.ContentProviderpublic android.net.Uri insert(android.net.Uri uri,
android.content.ContentValues values)
insert in class android.content.ContentProviderpublic android.database.Cursor query(android.net.Uri uri,
java.lang.String[] projection,
java.lang.String selection,
java.lang.String[] selectionArgs,
java.lang.String sortOrder)
query in class android.content.ContentProviderpublic int update(android.net.Uri uri,
android.content.ContentValues values,
java.lang.String selection,
java.lang.String[] selectionArgs)
update in class android.content.ContentProviderpublic int delete(android.net.Uri uri,
java.lang.String selection,
java.lang.String[] selectionArgs)
delete in class android.content.ContentProviderCopyright © 2015 arconsis IT-Solutions GmbH. All Rights Reserved.