public class ProviderCompartment
extends java.lang.Object
| Modifier and Type | Class and Description |
|---|---|
static class |
ProviderCompartment.QueryBuilder<T> |
| Modifier | Constructor and Description |
|---|---|
protected |
ProviderCompartment(Cupboard cupboard,
android.content.Context context) |
| Modifier and Type | Method and Description |
|---|---|
int |
delete(android.net.Uri uri,
java.lang.String selection,
java.lang.String... selectionArgs)
Delete by selection.
|
<T> int |
delete(android.net.Uri uri,
T entity)
Delete an entity
|
<T> T |
get(android.net.Uri uri,
java.lang.Class<T> entityClass)
Get an entity from a content provider
|
<T> T |
get(android.net.Uri uri,
T entity)
Get an entity by example, the id of the entity must be set.
|
protected <T> EntityConverter<T> |
getConverter(java.lang.Class<T> clz) |
<T> int |
put(android.net.Uri uri,
java.lang.Class<T> entityClass,
java.util.Collection<T> entities)
Put multiple entities using
ContentProvider.bulkInsert(Uri, ContentValues[]) |
<T> int |
put(android.net.Uri uri,
java.lang.Class<T> entityClass,
T... entities)
Put multiple entities using
ContentProvider.bulkInsert(Uri, ContentValues[]) |
<T> android.net.Uri |
put(android.net.Uri uri,
T entity)
Put (insert) an object to a content uri.
|
<T> ProviderCompartment.QueryBuilder<T> |
query(android.net.Uri uri,
java.lang.Class<T> entityClass)
Query for entities
|
int |
update(android.net.Uri uri,
android.content.ContentValues values)
Update entities using the update method of
ContentResolver. |
int |
update(android.net.Uri uri,
android.content.ContentValues values,
java.lang.String selection,
java.lang.String... selectionArgs)
Update entities using the update method of
ContentResolver. |
protected final Cupboard mCupboard
protected ProviderCompartment(Cupboard cupboard, android.content.Context context)
public <T> T get(android.net.Uri uri,
java.lang.Class<T> entityClass)
uri - the uri to get fromentityClass - the entity classpublic <T> android.net.Uri put(android.net.Uri uri,
T entity)
uri - the uri to insert toentity - the entity. If the entity has it's id field set, then this id will be appended to the uri as per ContentUris.appendId(android.net.Uri.Builder, long)public <T> int put(android.net.Uri uri,
java.lang.Class<T> entityClass,
T... entities)
ContentProvider.bulkInsert(Uri, ContentValues[])uri - the uri to callentityClass - the type of the entitiesentities - the entitiesContentProvider.bulkInsert(Uri, ContentValues[])public <T> int put(android.net.Uri uri,
java.lang.Class<T> entityClass,
java.util.Collection<T> entities)
ContentProvider.bulkInsert(Uri, ContentValues[])uri - the uri to callentityClass - the type of the entitiesentities - the collection of entitiesContentProvider.bulkInsert(Uri, ContentValues[])public <T> int delete(android.net.Uri uri,
T entity)
uri - the uri to call. The object id will be appended to this uri as per ContentUris.appendId(android.net.Uri.Builder, long). Calling delete on an entity without an id set is a no op.entity - the entity to deletepublic int delete(android.net.Uri uri,
java.lang.String selection,
java.lang.String... selectionArgs)
ContentResolver.delete(android.net.Uri, String, String[])uri - the uri to callselection - the selection for this deleteselectionArgs - selection argumentspublic int update(android.net.Uri uri,
android.content.ContentValues values)
ContentResolver. Useful for 'partial' updates to an entity, or
multiple entities.
For updating 'complete' entities in bulk, use put(android.net.Uri, Class, Object[]) or put(android.net.Uri, Class, java.util.Collection)values - the content values. If it contains a BaseColumns._ID then the id will be appended to the URI and
the selection "_id = <entity id>" will be passed to the underlying ContentProviderpublic int update(android.net.Uri uri,
android.content.ContentValues values,
java.lang.String selection,
java.lang.String... selectionArgs)
ContentResolver. Useful for 'partial' updates to an entity, or
multiple entities.values - content valuesselection - where clauseselectionArgs - selection argumentspublic <T> ProviderCompartment.QueryBuilder<T> query(android.net.Uri uri, java.lang.Class<T> entityClass)
uri - the uri to queryentityClass - the entity classProviderCompartment.QueryBuilder for chainingpublic <T> T get(android.net.Uri uri,
T entity)
uri - The base uri of the entity, the id will be appendedentity - the entity to getjava.lang.IllegalArgumentException - if the entity id is not set.protected <T> EntityConverter<T> getConverter(java.lang.Class<T> clz)