AppSearchBatchResult.Builder
class AppSearchBatchResult.Builder<KeyType, ValueType>
Builder for AppSearchBatchResult objects.
| Parameters | |
|---|---|
<KeyType> |
The type of the keys for which the results will be reported. |
<ValueType> |
The type of the result objects for successful results. |
Summary
Public constructors |
|---|
Builder()Creates a new |
@ExperimentalAppSearchApiCreates a new |
Public functions |
|
|---|---|
AppSearchBatchResult<KeyType!, ValueType!> |
build()Builds an |
AppSearchBatchResult.Builder<KeyType!, ValueType!> |
setFailure(key: KeyType, resultCode: Int, errorMessage: String?)Associates the |
AppSearchBatchResult.Builder<KeyType!, ValueType!> |
setResult(key: KeyType, result: AppSearchResult<ValueType!>)Associates the |
AppSearchBatchResult.Builder<KeyType!, ValueType!> |
setSuccess(key: KeyType, value: ValueType?)Associates the |
Public constructors
Builder
@ExperimentalAppSearchApi
Builder(appSearchBatchResult: AppSearchBatchResult<KeyType!, ValueType!>)
Creates a new Builder from the given AppSearchBatchResult.
Public functions
build
fun build(): AppSearchBatchResult<KeyType!, ValueType!>
Builds an AppSearchBatchResult object from the contents of this Builder.
setFailure
fun setFailure(key: KeyType, resultCode: Int, errorMessage: String?): AppSearchBatchResult.Builder<KeyType!, ValueType!>
Associates the key with the provided failure code and error message.
Any previous mapping for a key, whether success or failure, is deleted.
This is a convenience function which is equivalent to setResult(key, AppSearchResult.newFailedResult(resultCode, errorMessage)).
| Parameters | |
|---|---|
key: KeyType |
The key to associate the result with; usually corresponds to some identifier from the input like an ID or name. |
resultCode: Int |
One of the constants documented in |
errorMessage: String? |
An optional string describing the reason or nature of the failure. |
setResult
fun setResult(key: KeyType, result: AppSearchResult<ValueType!>): AppSearchBatchResult.Builder<KeyType!, ValueType!>
Associates the key with the provided result.
Any previous mapping for a key, whether success or failure, is deleted.
| Parameters | |
|---|---|
key: KeyType |
The key to associate the result with; usually corresponds to some identifier from the input like an ID or name. |
result: AppSearchResult<ValueType!> |
The result to associate with the key. |
setSuccess
fun setSuccess(key: KeyType, value: ValueType?): AppSearchBatchResult.Builder<KeyType!, ValueType!>
Associates the key with the provided successful return value.
Any previous mapping for a key, whether success or failure, is deleted.
This is a convenience function which is equivalent to setResult(key, AppSearchResult.newSuccessfulResult(value)).
| Parameters | |
|---|---|
key: KeyType |
The key to associate the result with; usually corresponds to some identifier from the input like an ID or name. |
value: ValueType? |
An optional value to associate with the successful result of the operation being performed. |