Android APIs
public class

ContentProviderOperation

extends Object
implements Parcelable
java.lang.Object
   ↳ android.content.ContentProviderOperation

Summary

Nested Classes
class ContentProviderOperation.Builder Used to add parameters to a ContentProviderOperation
[Expand]
Inherited Constants
From interface android.os.Parcelable
Fields
public static final Creator<ContentProviderOperation> CREATOR
Public Methods
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.
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 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 withSelection(String, 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.
[Expand]
Inherited Methods
From class java.lang.Object
From interface android.os.Parcelable

Fields

public static final Creator<ContentProviderOperation> CREATOR

Added in API level 5

Public Methods

public ContentProviderResult apply (ContentProvider provider, ContentProviderResult[] backRefs, int numBackRefs)

Added in API level 5

Applies this operation using the given provider. The backRefs array is used to resolve any back references that were requested using withValueBackReferences(ContentValues) and withSelectionBackReference(int, int).

Parameters
provider the ContentProvider on which this batch is applied
backRefs a ContentProviderResult array that will be consulted to resolve any requested back references.
numBackRefs the number of valid results on the backRefs array.
Returns
  • a ContentProviderResult that contains either the Uri of the inserted row if this was an insert otherwise the number of rows affected.
Throws
OperationApplicationException thrown if either the insert fails or if the number of rows affected didn't match the expected count

public int describeContents ()

Added in API level 5

Describe the kinds of special objects contained in this Parcelable's marshalled representation.

Returns
  • a bitmask indicating the set of special object types marshalled by the Parcelable.

public Uri getUri ()

Added in API level 5

public boolean isReadOperation ()

Added in API level 5

public boolean isWriteOperation ()

Added in API level 5

public boolean isYieldAllowed ()

Added in API level 5

public static ContentProviderOperation.Builder newAssertQuery (Uri uri)

Added in API level 5

Create a ContentProviderOperation.Builder suitable for building a ContentProviderOperation to assert a set of values as provided through withValues(ContentValues).

public static ContentProviderOperation.Builder newDelete (Uri uri)

Added in API level 5

Create a ContentProviderOperation.Builder suitable for building a delete ContentProviderOperation.

Parameters
uri The Uri that is the target of the delete.

public static ContentProviderOperation.Builder newInsert (Uri uri)

Added in API level 5

Create a ContentProviderOperation.Builder suitable for building an insert ContentProviderOperation.

Parameters
uri The Uri that is the target of the insert.

public static ContentProviderOperation.Builder newUpdate (Uri uri)

Added in API level 5

Create a ContentProviderOperation.Builder suitable for building an update ContentProviderOperation.

Parameters
uri The Uri that is the target of the update.

public String[] resolveSelectionArgsBackReferences (ContentProviderResult[] backRefs, int numBackRefs)

Added in API level 5

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 withSelection(String, 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

Parameters
backRefs an array of previous results
numBackRefs the number of valid previous results in backRefs
Returns
  • the ContentValues that should be used in this operation application after expansion of back references. This can be called if either mValues or mValuesBackReferences is null

public ContentValues resolveValueBackReferences (ContentProviderResult[] backRefs, int numBackRefs)

Added in API level 5

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.

This is intended to be a private method but it is exposed for unit testing purposes

Parameters
backRefs an array of previous results
numBackRefs the number of valid previous results in backRefs
Returns
  • the ContentValues that should be used in this operation application after expansion of back references. This can be called if either mValues or mValuesBackReferences is null

public String toString ()

Added in API level 5

Returns a string containing a concise, human-readable description of this object. Subclasses are encouraged to override this method and provide an implementation that takes into account the object's type and data. The default implementation is equivalent to the following expression:

   getClass().getName() + '@' + Integer.toHexString(hashCode())

See Writing a useful toString method if you intend implementing your own toString method.

Returns
  • a printable representation of this object.

public void writeToParcel (Parcel dest, int flags)

Added in API level 5

Flatten this object in to a Parcel.

Parameters
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_WRITE_RETURN_VALUE.