AppSearchBatchResult.Builder
public final 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 methods |
|
|---|---|
@NonNull AppSearchBatchResult<KeyType, ValueType> |
build()Builds an |
@NonNull AppSearchBatchResult.Builder<KeyType, ValueType> |
setFailure(Associates the |
@NonNull AppSearchBatchResult.Builder<KeyType, ValueType> |
setResult(@NonNull KeyType key, @NonNull AppSearchResult<ValueType> result)Associates the |
@NonNull AppSearchBatchResult.Builder<KeyType, ValueType> |
setSuccess(@NonNull KeyType key, @Nullable ValueType value)Associates the |
Public constructors
Builder
@ExperimentalAppSearchApi
public Builder(
@NonNull AppSearchBatchResult<KeyType, ValueType> appSearchBatchResult
)
Creates a new Builder from the given AppSearchBatchResult.
Public methods
build
public @NonNull AppSearchBatchResult<KeyType, ValueType> build()
Builds an AppSearchBatchResult object from the contents of this Builder.
setFailure
public @NonNull AppSearchBatchResult.Builder<KeyType, ValueType> setFailure(
@NonNull KeyType key,
int resultCode,
@Nullable String errorMessage
)
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 | |
|---|---|
@NonNull KeyType key |
The key to associate the result with; usually corresponds to some identifier from the input like an ID or name. |
int resultCode |
One of the constants documented in |
@Nullable String errorMessage |
An optional string describing the reason or nature of the failure. |
setResult
public @NonNull AppSearchBatchResult.Builder<KeyType, ValueType> setResult(@NonNull KeyType key, @NonNull AppSearchResult<ValueType> result)
Associates the key with the provided result.
Any previous mapping for a key, whether success or failure, is deleted.
| Parameters | |
|---|---|
@NonNull KeyType key |
The key to associate the result with; usually corresponds to some identifier from the input like an ID or name. |
@NonNull AppSearchResult<ValueType> result |
The result to associate with the key. |
setSuccess
public @NonNull AppSearchBatchResult.Builder<KeyType, ValueType> setSuccess(@NonNull KeyType key, @Nullable ValueType value)
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)).