Added in API level 5

Builder


open class Builder
kotlin.Any
   ↳ android.content.ContentProviderOperation.Builder

Used to add parameters to a ContentProviderOperation. The 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 Builder type each is allowed. Call build to create the ContentProviderOperation once all the parameters have been supplied.

Summary

Public methods
open ContentProviderOperation

Create a ContentProviderOperation from this Builder.

open ContentProviderOperation.Builder
withExceptionAllowed(exceptionAllowed: Boolean)

If set to true, this operation allows subsequent operations to continue even if this operation throws an exception.

open ContentProviderOperation.Builder

If set then if the number of rows affected by this operation does not match this count OperationApplicationException will be throw.

open ContentProviderOperation.Builder
withExtra(key: String, value: Any?)

Configure the given extra to use for this operation.

open ContentProviderOperation.Builder
withExtraBackReference(key: String, fromIndex: Int)

Configure the given extra to be dynamically overwritten using the result of a previous operation.

open ContentProviderOperation.Builder
withExtraBackReference(key: String, fromIndex: Int, fromKey: String)

Configure the given extra to be dynamically overwritten using the result of a previous operation.

open ContentProviderOperation.Builder
withExtras(extras: Bundle)

Configure the extras to use for this operation.

open ContentProviderOperation.Builder
withSelection(selection: String?, selectionArgs: Array<String!>?)

Configure the selection and selection arguments to use for this operation.

open ContentProviderOperation.Builder
withSelectionBackReference(index: Int, fromIndex: Int)

Configure the given selection argument to be dynamically overwritten using the result of a previous operation.

open ContentProviderOperation.Builder
withSelectionBackReference(index: Int, fromIndex: Int, fromKey: String)

Configure the given selection argument to be dynamically overwritten using the result of a previous operation.

open ContentProviderOperation.Builder
withValue(key: String, value: Any?)

Configure the given value to use for this operation.

open ContentProviderOperation.Builder
withValueBackReference(key: String, fromIndex: Int)

Configure the given value to be dynamically overwritten using the result of a previous operation.

open ContentProviderOperation.Builder
withValueBackReference(key: String, fromIndex: Int, fromKey: String)

Configure the given value to be dynamically overwritten using the result of a previous operation.

open ContentProviderOperation.Builder

Configure the given values to be dynamically overwritten using the result of a previous operation.

open ContentProviderOperation.Builder

Configure the values to use for this operation.

open ContentProviderOperation.Builder
withYieldAllowed(yieldAllowed: Boolean)

If set to true then the operation allows yielding the database to other transactions if the database is contended.

Public methods

build

Added in API level 5
open fun build(): ContentProviderOperation

Create a ContentProviderOperation from this Builder.

Return
ContentProviderOperation This value cannot be null.

withExceptionAllowed

Added in API level 30
open fun withExceptionAllowed(exceptionAllowed: Boolean): ContentProviderOperation.Builder

If set to true, this operation allows subsequent operations to continue even if this operation throws an exception. When true, any encountered exception is returned via ContentProviderResult#exception.

Return
ContentProviderOperation.Builder This value cannot be null.

withExpectedCount

Added in API level 5
open fun withExpectedCount(count: Int): ContentProviderOperation.Builder

If set then if the number of rows affected by this operation does not match this count OperationApplicationException will be throw. This can only be used with builders of type update, delete, or assert.

Return
ContentProviderOperation.Builder this builder, to allow for chaining. This value cannot be null.

withExtra

Added in API level 30
open fun withExtra(
    key: String,
    value: Any?
): ContentProviderOperation.Builder

Configure the given extra to use for this operation. This method will replace any previously defined extras for this key.

Parameters
key String: the key indicating which extra to configure This value cannot be null.
value Any?: This value may be null.
Return
ContentProviderOperation.Builder This value cannot be null.

withExtraBackReference

Added in API level 30
open fun withExtraBackReference(
    key: String,
    fromIndex: Int
): ContentProviderOperation.Builder

Configure the given extra to be dynamically overwritten using the result of a previous operation. This method will replace any previously defined extras for this key.

Parameters
key String: the key indicating which extra to configure This value cannot be null.
fromIndex Int: the index indicating which historical ContentProviderResult should overwrite the extra
Return
ContentProviderOperation.Builder This value cannot be null.

withExtraBackReference

Added in API level 30
open fun withExtraBackReference(
    key: String,
    fromIndex: Int,
    fromKey: String
): ContentProviderOperation.Builder

Configure the given extra to be dynamically overwritten using the result of a previous operation. This method will replace any previously defined extras for this key.

Parameters
key String: the key indicating which extra to configure This value cannot be null.
fromIndex Int: the index indicating which historical ContentProviderResult should overwrite the extra
fromKey String: the key of indicating which ContentProviderResult#extras value should overwrite the extra This value cannot be null.
Return
ContentProviderOperation.Builder This value cannot be null.

withExtras

Added in API level 30
open fun withExtras(extras: Bundle): ContentProviderOperation.Builder

Configure the extras to use for this operation. This method will replace any previously defined values for the contained keys, but it will not replace any back-reference requests.

Any value may be dynamically overwritten using the result of a previous operation by using methods such as withExtraBackReference(java.lang.String,int).

Parameters
extras Bundle: This value cannot be null.
Return
ContentProviderOperation.Builder This value cannot be null.

withSelection

Added in API level 5
open fun withSelection(
    selection: String?,
    selectionArgs: Array<String!>?
): ContentProviderOperation.Builder

Configure the selection and selection arguments to use for this operation. This method will replace any previously defined selection and selection arguments, but it will not replace any back-reference requests.

An occurrence of ? in the selection will be replaced with the corresponding selection argument when the operation is executed.

Any selection argument may be dynamically overwritten using the result of a previous operation by using methods such as withSelectionBackReference(int,int).

Parameters
selection String?: This value may be null.
selectionArgs Array<String!>?: This value may be null.
Return
ContentProviderOperation.Builder This value cannot be null.

withSelectionBackReference

Added in API level 5
open fun withSelectionBackReference(
    index: Int,
    fromIndex: Int
): ContentProviderOperation.Builder

Configure the given selection argument to be dynamically overwritten using the result of a previous operation. This method will replace any previously defined selection argument at this index.

Parameters
index Int: the index indicating which selection argument to configure
fromIndex Int: the index indicating which historical ContentProviderResult should overwrite the selection argument
Return
ContentProviderOperation.Builder This value cannot be null.

withSelectionBackReference

Added in API level 30
open fun withSelectionBackReference(
    index: Int,
    fromIndex: Int,
    fromKey: String
): ContentProviderOperation.Builder

Configure the given selection argument to be dynamically overwritten using the result of a previous operation. This method will replace any previously defined selection argument at this index.

Parameters
index Int: the index indicating which selection argument to configure
fromIndex Int: the index indicating which historical ContentProviderResult should overwrite the selection argument
fromKey String: the key of indicating which ContentProviderResult#extras value should overwrite the selection argument This value cannot be null.
Return
ContentProviderOperation.Builder This value cannot be null.

withValue

Added in API level 5
open fun withValue(
    key: String,
    value: Any?
): ContentProviderOperation.Builder

Configure the given value to use for this operation. This method will replace any previously defined value for this key.

Parameters
key String: the key indicating which value to configure This value cannot be null.
value Any?: This value may be null.
Return
ContentProviderOperation.Builder This value cannot be null.

withValueBackReference

Added in API level 5
open fun withValueBackReference(
    key: String,
    fromIndex: Int
): ContentProviderOperation.Builder

Configure the given value to be dynamically overwritten using the result of a previous operation. This method will replace any previously defined value for this key.

Parameters
key String: the key indicating which value to configure This value cannot be null.
fromIndex Int: the index indicating which historical ContentProviderResult should overwrite the value
Return
ContentProviderOperation.Builder This value cannot be null.

withValueBackReference

Added in API level 30
open fun withValueBackReference(
    key: String,
    fromIndex: Int,
    fromKey: String
): ContentProviderOperation.Builder

Configure the given value to be dynamically overwritten using the result of a previous operation. This method will replace any previously defined value for this key.

Parameters
key String: the key indicating which value to configure This value cannot be null.
fromIndex Int: the index indicating which historical ContentProviderResult should overwrite the value
fromKey String: the key of indicating which ContentProviderResult#extras value should overwrite the value This value cannot be null.
Return
ContentProviderOperation.Builder This value cannot be null.

withValueBackReferences

Added in API level 5
open fun withValueBackReferences(backReferences: ContentValues): ContentProviderOperation.Builder

Configure the given values to be dynamically overwritten using the result of a previous operation. This method will replace any previously defined values for these keys.

Parameters
backReferences ContentValues: set of values where the key indicates which value to configure and the value the index indicating which historical ContentProviderResult should overwrite the value This value cannot be null.
Return
ContentProviderOperation.Builder This value cannot be null.

withValues

Added in API level 5
open fun withValues(values: ContentValues): ContentProviderOperation.Builder

Configure the values to use for this operation. This method will replace any previously defined values for the contained keys, but it will not replace any back-reference requests.

Any value may be dynamically overwritten using the result of a previous operation by using methods such as withValueBackReference(java.lang.String,int).

Parameters
values ContentValues: This value cannot be null.
Return
ContentProviderOperation.Builder This value cannot be null.

withYieldAllowed

Added in API level 5
open fun withYieldAllowed(yieldAllowed: Boolean): ContentProviderOperation.Builder

If set to true then the operation allows yielding the database to other transactions if the database is contended.

Return
ContentProviderOperation.Builder this builder, to allow for chaining. This value cannot be null.