ContentProviderOperation
public
class
ContentProviderOperation
extends Object
implements
Parcelable
java.lang.Object | |
↳ | android.content.ContentProviderOperation |
Represents a single operation to be performed as part of a batch of operations.
See also:
Summary
Nested classes | |
---|---|
class |
ContentProviderOperation.Builder
Used to add parameters to a |
Inherited constants |
---|
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 instance's marshaled representation. |
Uri
|
getUri()
Gets the Uri for the target of the operation. |
boolean
|
isAssertQuery()
Returns true if the operation represents an assert query. |
boolean
|
isDelete()
Returns true if the operation represents a deletion. |
boolean
|
isInsert()
Returns true if the operation represents an insertion. |
boolean
|
isReadOperation()
Returns true if the operation represents an assert query. |
boolean
|
isUpdate()
Returns true if the operation represents an update. |
boolean
|
isWriteOperation()
Returns true if the operation represents an insertion, deletion, or update. |
boolean
|
isYieldAllowed()
Returns true if the operation allows yielding the database to other transactions if the database is contended. |
static
ContentProviderOperation.Builder
|
newAssertQuery(Uri uri)
Create a |
static
ContentProviderOperation.Builder
|
newDelete(Uri uri)
Create a |
static
ContentProviderOperation.Builder
|
newInsert(Uri uri)
Create a |
static
ContentProviderOperation.Builder
|
newUpdate(Uri uri)
Create a |
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 |
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 representation of the object. |
void
|
writeToParcel(Parcel dest, int flags)
Flatten this object in to a Parcel. |
Inherited methods | |
---|---|
Fields
Public methods
apply
ContentProviderResult apply (ContentProvider provider, ContentProviderResult[] backRefs, int numBackRefs)
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 |
ContentProvider : the ContentProvider on which this batch is applied |
backRefs |
ContentProviderResult : a ContentProviderResult array that will be consulted
to resolve any requested back references. |
numBackRefs |
int : the number of valid results on the backRefs array. |
Returns | |
---|---|
ContentProviderResult |
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 |
describeContents
int describeContents ()
Describe the kinds of special objects contained in this Parcelable
instance's marshaled representation. For example, if the object will
include a file descriptor in the output of writeToParcel(Parcel, int)
,
the return value of this method must include the
CONTENTS_FILE_DESCRIPTOR
bit.
Returns | |
---|---|
int |
a bitmask indicating the set of special object types marshaled by this Parcelable object instance. |
isAssertQuery
boolean isAssertQuery ()
Returns true if the operation represents an assert query.
Returns | |
---|---|
boolean |
See also:
isDelete
boolean isDelete ()
Returns true if the operation represents a deletion.
Returns | |
---|---|
boolean |
See also:
isInsert
boolean isInsert ()
Returns true if the operation represents an insertion.
Returns | |
---|---|
boolean |
See also:
isReadOperation
boolean isReadOperation ()
Returns true if the operation represents an assert query.
Returns | |
---|---|
boolean |
See also:
isUpdate
boolean isUpdate ()
Returns true if the operation represents an update.
Returns | |
---|---|
boolean |
See also:
isWriteOperation
boolean isWriteOperation ()
Returns true if the operation represents an insertion, deletion, or update.
Returns | |
---|---|
boolean |
See also:
isYieldAllowed
boolean isYieldAllowed ()
Returns true if the operation allows yielding the database to other transactions if the database is contended.
Returns | |
---|---|
boolean |
See also:
newAssertQuery
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)
.
Parameters | |
---|---|
uri |
Uri |
Returns | |
---|---|
ContentProviderOperation.Builder |
newDelete
ContentProviderOperation.Builder newDelete (Uri uri)
Create a ContentProviderOperation.Builder
suitable for building a delete ContentProviderOperation
.
Parameters | |
---|---|
uri |
Uri : The Uri that is the target of the delete. |
Returns | |
---|---|
ContentProviderOperation.Builder |
a ContentProviderOperation.Builder
|
newInsert
ContentProviderOperation.Builder newInsert (Uri uri)
Create a ContentProviderOperation.Builder
suitable for building an insert ContentProviderOperation
.
Parameters | |
---|---|
uri |
Uri : The Uri that is the target of the insert. |
Returns | |
---|---|
ContentProviderOperation.Builder |
a ContentProviderOperation.Builder
|
newUpdate
ContentProviderOperation.Builder newUpdate (Uri uri)
Create a ContentProviderOperation.Builder
suitable for building an update ContentProviderOperation
.
Parameters | |
---|---|
uri |
Uri : The Uri that is the target of the update. |
Returns | |
---|---|
ContentProviderOperation.Builder |
a ContentProviderOperation.Builder
|
resolveSelectionArgsBackReferences
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.
This is intended to be a private method but it is exposed for unit testing purposes
Parameters | |
---|---|
backRefs |
ContentProviderResult : an array of previous results |
numBackRefs |
int : the number of valid previous results in backRefs |
Returns | |
---|---|
String[] |
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 |
resolveValueBackReferences
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.
This is intended to be a private method but it is exposed for unit testing purposes
Parameters | |
---|---|
backRefs |
ContentProviderResult : an array of previous results |
numBackRefs |
int : the number of valid previous results in backRefs |
Returns | |
---|---|
ContentValues |
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 |
toString
String toString ()
Returns a string representation of the object. In general, the
toString
method returns a string that
"textually represents" this object. The result should
be a concise but informative representation that is easy for a
person to read.
It is recommended that all subclasses override this method.
The toString
method for class Object
returns a string consisting of the name of the class of which the
object is an instance, the at-sign character `@
', and
the unsigned hexadecimal representation of the hash code of the
object. In other words, this method returns a string equal to the
value of:
getClass().getName() + '@' + Integer.toHexString(hashCode())
Returns | |
---|---|
String |
a string representation of the object. |
writeToParcel
void writeToParcel (Parcel dest, int flags)
Flatten this object in to a Parcel.
Parameters | |
---|---|
dest |
Parcel : The Parcel in which the object should be written. |
flags |
int : Additional flags about how the object should be written.
May be 0 or PARCELABLE_WRITE_RETURN_VALUE .
|
Interfaces
- ClipboardManager.OnPrimaryClipChangedListener
- ComponentCallbacks
- ComponentCallbacks2
- ContentProvider.PipeDataWriter
- DialogInterface
- DialogInterface.OnCancelListener
- DialogInterface.OnClickListener
- DialogInterface.OnDismissListener
- DialogInterface.OnKeyListener
- DialogInterface.OnMultiChoiceClickListener
- DialogInterface.OnShowListener
- EntityIterator
- IntentSender.OnFinished
- Loader.OnLoadCanceledListener
- Loader.OnLoadCompleteListener
- ServiceConnection
- SharedPreferences
- SharedPreferences.Editor
- SharedPreferences.OnSharedPreferenceChangeListener
- SyncStatusObserver
Classes
- AbstractThreadedSyncAdapter
- AsyncQueryHandler
- AsyncQueryHandler.WorkerArgs
- AsyncQueryHandler.WorkerHandler
- AsyncTaskLoader
- BroadcastReceiver
- BroadcastReceiver.PendingResult
- ClipboardManager
- ClipData
- ClipData.Item
- ClipDescription
- ComponentName
- ContentProvider
- ContentProviderClient
- ContentProviderOperation
- ContentProviderOperation.Builder
- ContentProviderResult
- ContentQueryMap
- ContentResolver
- ContentUris
- ContentValues
- Context
- ContextWrapper
- CursorLoader
- Entity
- Entity.NamedContentValues
- Intent
- Intent.FilterComparison
- Intent.ShortcutIconResource
- IntentFilter
- IntentFilter.AuthorityEntry
- IntentSender
- Loader
- Loader.ForceLoadContentObserver
- MutableContextWrapper
- PeriodicSync
- QuickViewConstants
- RestrictionEntry
- RestrictionsManager
- SearchRecentSuggestionsProvider
- SyncAdapterType
- SyncContext
- SyncInfo
- SyncRequest
- SyncRequest.Builder
- SyncResult
- SyncStats
- UriMatcher
- UriPermission
Exceptions