public static class ContentProviderOperation.Builder extends Object
ContentProviderOperation
. The ContentProviderOperation.Builder
is
first created by calling ContentProviderOperation.newInsert(android.net.Uri)
,
ContentProviderOperation.newUpdate(android.net.Uri)
,
ContentProviderOperation.newDelete(android.net.Uri)
or
ContentProviderOperation.newAssertQuery(Uri)
. The withXXX methods
can then be used to add parameters to the builder. See the specific methods to find for
which ContentProviderOperation.Builder
type each is allowed. Call build()
to create the
ContentProviderOperation
once all the parameters have been supplied.Modifier and Type | Method and Description |
---|---|
ContentProviderOperation |
build()
Create a ContentProviderOperation from this
ContentProviderOperation.Builder . |
ContentProviderOperation.Builder |
withExpectedCount(int count)
If set then if the number of rows affected by this operation does not match
this count
OperationApplicationException will be throw. |
ContentProviderOperation.Builder |
withSelection(String selection,
String[] selectionArgs)
The selection and arguments to use.
|
ContentProviderOperation.Builder |
withSelectionBackReference(int selectionArgIndex,
int previousResult)
Add a back references as a selection arg.
|
ContentProviderOperation.Builder |
withValue(String key,
Object value)
A value to insert or update.
|
ContentProviderOperation.Builder |
withValueBackReference(String key,
int previousResult)
Add a ContentValues back reference.
|
ContentProviderOperation.Builder |
withValueBackReferences(ContentValues backReferences)
Add a
ContentValues of back references. |
ContentProviderOperation.Builder |
withValues(ContentValues values)
The ContentValues to use.
|
ContentProviderOperation.Builder |
withYieldAllowed(boolean yieldAllowed)
If set to true then the operation allows yielding the database to other transactions
if the database is contended.
|
public ContentProviderOperation build()
ContentProviderOperation.Builder
.public ContentProviderOperation.Builder withValueBackReferences(ContentValues backReferences)
ContentValues
of back references. The key is the name of the column
and the value is an integer that is the index of the previous result whose
value should be used for the column. The value is added as a String
.
A column value from the back references takes precedence over a value specified in
withValues(android.content.ContentValues)
.
This can only be used with builders of type insert, update, or assert.public ContentProviderOperation.Builder withValueBackReference(String key, int previousResult)
withValues(android.content.ContentValues)
.
This can only be used with builders of type insert, update, or assert.public ContentProviderOperation.Builder withSelectionBackReference(int selectionArgIndex, int previousResult)
withSelection(java.lang.String, java.lang.String[])
will be overwritten.
This can only be used with builders of type update, delete, or assert.public ContentProviderOperation.Builder withValues(ContentValues values)
withValueBackReference(java.lang.String, int)
or by
future calls to withValues(android.content.ContentValues)
or withValue(java.lang.String, java.lang.Object)
.
This can only be used with builders of type insert, update, or assert.public ContentProviderOperation.Builder withValue(String key, Object value)
withValueBackReference(java.lang.String, int)
.
This can only be used with builders of type insert, update, or assert.key
- the name of this valuevalue
- the value itself. the type must be acceptable for insertion by
ContentValues.put(java.lang.String, java.lang.String)
public ContentProviderOperation.Builder withSelection(String selection, String[] selectionArgs)
withSelectionBackReference(int, int)
.
This can only be used with builders of type update, delete, or assert.public ContentProviderOperation.Builder withExpectedCount(int count)
OperationApplicationException
will be throw.
This can only be used with builders of type update, delete, or assert.public ContentProviderOperation.Builder withYieldAllowed(boolean yieldAllowed)
SQLiteDatabase.yieldIfContendedSafely()