public static class ContentProviderOperation.Builder
extends Object
| java.lang.Object | |
| android.content.ContentProviderOperation.Builder | |
用于将参数添加到ContentProviderOperation 。 该ContentProviderOperation.Builder首先通过调用创建newInsert(android.net.Uri) , newUpdate(android.net.Uri) , newDelete(android.net.Uri)或者newAssertQuery(Uri) 。 然后可以使用withXXX方法将参数添加到构建器。 查看具体的方法来找到每个允许的ContentProviderOperation.Builder类型。 一旦提供了所有参数,请致电build()以创建ContentProviderOperation 。
公共方法(Public methods) |
|
|---|---|
ContentProviderOperation |
build() 从这个 |
ContentProviderOperation.Builder |
withExpectedCount(int count) 如果设置,则如果受此操作影响的行数不匹配,则计数 |
ContentProviderOperation.Builder |
withSelection(String selection, String[] selectionArgs) 选择和参数使用。 |
ContentProviderOperation.Builder |
withSelectionBackReference(int selectionArgIndex, int previousResult) 添加后退引用作为选择参数。 |
ContentProviderOperation.Builder |
withValue(String key, Object value) 要插入或更新的值。 |
ContentProviderOperation.Builder |
withValueBackReference(String key, int previousResult) 添加一个ContentValues反向引用。 |
ContentProviderOperation.Builder |
withValueBackReferences(ContentValues backReferences) 添加 |
ContentProviderOperation.Builder |
withValues(ContentValues values) 要使用的ContentValues。 |
ContentProviderOperation.Builder |
withYieldAllowed(boolean yieldAllowed) 如果设置为true,那么该操作允许数据库在其他事务中产生,如果数据库被争用。 |
继承方法(Inherited methods) |
|
|---|---|
java.lang.Object
|
|
ContentProviderOperation build ()
从这个 ContentProviderOperation.Builder创建一个ContentProviderOperation。
| 返回(Returns) | |
|---|---|
ContentProviderOperation |
|
ContentProviderOperation.Builder withExpectedCount (int count)
如果设置,则如果受此操作影响的行数不匹配,则计数OperationApplicationException将被丢弃。 这只能用于update,delete或assert类型的构建器。
| 参数(Parameters) | |
|---|---|
count |
int
|
| 返回(Returns) | |
|---|---|
ContentProviderOperation.Builder |
this builder, to allow for chaining. |
ContentProviderOperation.Builder withSelection (String selection, String[] selectionArgs)
选择和参数使用。 发生'?' 在选择中将被替换为选择参数的相应出现。 任何选择参数都可能被withSelectionBackReference(int, int)指定的选择参数返回引用覆盖。 这只能用于update,delete或assert类型的构建器。
| 参数(Parameters) | |
|---|---|
selection |
String
|
selectionArgs |
String
|
| 返回(Returns) | |
|---|---|
ContentProviderOperation.Builder |
this builder, to allow for chaining. |
ContentProviderOperation.Builder withSelectionBackReference (int selectionArgIndex, int previousResult)
添加后退引用作为选择参数。 由withSelection(String, String[])指定的选择参数索引中的任何值withSelection(String, String[])将被覆盖。 这只能用于update,delete或assert类型的构建器。
| 参数(Parameters) | |
|---|---|
selectionArgIndex |
int
|
previousResult |
int
|
| 返回(Returns) | |
|---|---|
ContentProviderOperation.Builder |
this builder, to allow for chaining. |
ContentProviderOperation.Builder withValue (String key, Object value)
要插入或更新的值。 该值可能会被withValueBackReference(String, int)指定的相应值覆盖。 这只能用于insert,update或assert类型的构建器。
| 参数(Parameters) | |
|---|---|
key |
String: the name of this value |
value |
Object: the value itself. the type must be acceptable for insertion by put(String, byte[]) |
| 返回(Returns) | |
|---|---|
ContentProviderOperation.Builder |
this builder, to allow for chaining. |
ContentProviderOperation.Builder withValueBackReference (String key, int previousResult)
添加一个ContentValues反向引用。 后向引用中的列值优先于withValues(ContentValues)指定的值。 这只能用于insert,update或assert类型的构建器。
| 参数(Parameters) | |
|---|---|
key |
String
|
previousResult |
int
|
| 返回(Returns) | |
|---|---|
ContentProviderOperation.Builder |
this builder, to allow for chaining. |
ContentProviderOperation.Builder withValueBackReferences (ContentValues backReferences)
添加后面引用的ContentValues 。 关键是列的名称,值是一个整数,它是以前结果的索引,其值应该用于列。 该值将作为String添加。 后向引用中的列值优先于withValues(ContentValues)指定的值。 这只能用于insert,update或assert类型的构建器。
| 参数(Parameters) | |
|---|---|
backReferences |
ContentValues
|
| 返回(Returns) | |
|---|---|
ContentProviderOperation.Builder |
this builder, to allow for chaining. |
ContentProviderOperation.Builder withValues (ContentValues values)
要使用的ContentValues。 这可能是空的。 这些值可能被withValueBackReference(String, int)指定的相应值或未来调用withValues(ContentValues)或withValue(String, Object) 。 这只能用于insert,update或assert类型的构建器。
| 参数(Parameters) | |
|---|---|
values |
ContentValues
|
| 返回(Returns) | |
|---|---|
ContentProviderOperation.Builder |
this builder, to allow for chaining. |
ContentProviderOperation.Builder withYieldAllowed (boolean yieldAllowed)
如果设置为true,那么该操作允许数据库在其他事务中产生,如果数据库被争用。
| 参数(Parameters) | |
|---|---|
yieldAllowed |
boolean
|
| 返回(Returns) | |
|---|---|
ContentProviderOperation.Builder |
this builder, to allow for chaining. |
也可以看看: