public class ContentProviderOperation extends Object implements Parcelable
Modifier and Type | Class and Description |
---|---|
static class |
ContentProviderOperation.Builder
Used to add parameters to a
ContentProviderOperation . |
Parcelable.ClassLoaderCreator<T>, Parcelable.Creator<T>
Modifier and Type | Field and Description |
---|---|
static Parcelable.Creator<ContentProviderOperation> |
CREATOR |
static int |
TYPE_ASSERT |
static int |
TYPE_DELETE |
static int |
TYPE_INSERT |
static int |
TYPE_UPDATE |
CONTENTS_FILE_DESCRIPTOR, PARCELABLE_WRITE_RETURN_VALUE
Modifier and Type | Method and Description |
---|---|
ContentProviderResult |
apply(ContentProvider provider,
ContentProviderResult[] backRefs,
int numBackRefs)
Applies this operation using the given provider.
|
int |
describeContents()
Describe the kinds of special objects contained in this Parcelable's
marshalled representation.
|
int |
getType() |
Uri |
getUri() |
boolean |
isReadOperation() |
boolean |
isWriteOperation() |
boolean |
isYieldAllowed() |
static ContentProviderOperation.Builder |
newAssertQuery(Uri uri)
Create a
ContentProviderOperation.Builder suitable for building a
ContentProviderOperation to assert a set of values as provided
through ContentProviderOperation.Builder.withValues(ContentValues) . |
static ContentProviderOperation.Builder |
newDelete(Uri uri)
Create a
ContentProviderOperation.Builder suitable for building a delete ContentProviderOperation . |
static ContentProviderOperation.Builder |
newInsert(Uri uri)
Create a
ContentProviderOperation.Builder suitable for building an insert ContentProviderOperation . |
static ContentProviderOperation.Builder |
newUpdate(Uri uri)
Create a
ContentProviderOperation.Builder suitable for building an update ContentProviderOperation . |
String[] |
resolveSelectionArgsBackReferences(ContentProviderResult[] backRefs,
int numBackRefs)
The Selection Arguments back references are represented as a Map of Integer->Integer where
the key is an index into the selection argument array (see
ContentProviderOperation.Builder.withSelection(java.lang.String, java.lang.String[]) )
and the value is the index of the previous result that should be used for that selection
argument array slot. |
ContentValues |
resolveValueBackReferences(ContentProviderResult[] backRefs,
int numBackRefs)
The ContentValues back references are represented as a ContentValues object where the
key refers to a column and the value is an index of the back reference whose
valued should be associated with the column.
|
String |
toString()
Returns a string containing a concise, human-readable description of this
object.
|
void |
writeToParcel(Parcel dest,
int flags)
Flatten this object in to a Parcel.
|
public static final int TYPE_INSERT
public static final int TYPE_UPDATE
public static final int TYPE_DELETE
public static final int TYPE_ASSERT
public static final Parcelable.Creator<ContentProviderOperation> CREATOR
public void writeToParcel(Parcel dest, int flags)
Parcelable
writeToParcel
in interface Parcelable
dest
- The Parcel in which the object should be written.flags
- Additional flags about how the object should be written.
May be 0 or Parcelable.PARCELABLE_WRITE_RETURN_VALUE
.public static ContentProviderOperation.Builder newInsert(Uri uri)
ContentProviderOperation.Builder
suitable for building an insert ContentProviderOperation
.uri
- The Uri
that is the target of the insert.ContentProviderOperation.Builder
public static ContentProviderOperation.Builder newUpdate(Uri uri)
ContentProviderOperation.Builder
suitable for building an update ContentProviderOperation
.uri
- The Uri
that is the target of the update.ContentProviderOperation.Builder
public static ContentProviderOperation.Builder newDelete(Uri uri)
ContentProviderOperation.Builder
suitable for building a delete ContentProviderOperation
.uri
- The Uri
that is the target of the delete.ContentProviderOperation.Builder
public static ContentProviderOperation.Builder newAssertQuery(Uri uri)
ContentProviderOperation.Builder
suitable for building a
ContentProviderOperation
to assert a set of values as provided
through ContentProviderOperation.Builder.withValues(ContentValues)
.public Uri getUri()
public boolean isYieldAllowed()
public int getType()
public boolean isWriteOperation()
public boolean isReadOperation()
public ContentProviderResult apply(ContentProvider provider, ContentProviderResult[] backRefs, int numBackRefs) throws OperationApplicationException
ContentProviderOperation.Builder.withValueBackReferences(ContentValues)
and
ContentProviderOperation.Builder.withSelectionBackReference(int, int)
.provider
- the ContentProvider
on which this batch is appliedbackRefs
- a ContentProviderResult
array that will be consulted
to resolve any requested back references.numBackRefs
- the number of valid results on the backRefs array.ContentProviderResult
that contains either the Uri
of the inserted
row if this was an insert otherwise the number of rows affected.OperationApplicationException
- thrown if either the insert fails or
if the number of rows affected didn't match the expected countpublic ContentValues resolveValueBackReferences(ContentProviderResult[] backRefs, int numBackRefs)
This is intended to be a private method but it is exposed for unit testing purposes
backRefs
- an array of previous resultsnumBackRefs
- the number of valid previous results in backRefspublic String[] resolveSelectionArgsBackReferences(ContentProviderResult[] backRefs, int numBackRefs)
ContentProviderOperation.Builder.withSelection(java.lang.String, java.lang.String[])
)
and the value is the index of the previous result that should be used for that selection
argument array slot.
This is intended to be a private method but it is exposed for unit testing purposes
backRefs
- an array of previous resultsnumBackRefs
- the number of valid previous results in backRefspublic String toString()
Object
getClass().getName() + '@' + Integer.toHexString(hashCode())
See Writing a useful
toString
method
if you intend implementing your own toString
method.
public int describeContents()
Parcelable
describeContents
in interface Parcelable