AppSearchBatchResult.Builder

public static final class AppSearchBatchResult.Builder extends Object

Builder for AppSearchBatchResult objects.

Public Constructor Summary

Public Method Summary

AppSearchBatchResult<KeyType, ValueType>
build()
Builds an AppSearchBatchResult object from the contents of this AppSearchBatchResult.Builder.
Builder<KeyType, ValueType>
setFailure(KeyType key, int resultCode, String errorMessage)
Associates the key with the provided failure code and error message.
Builder<KeyType, ValueType>
setResult(KeyType key, AppSearchResult<ValueType> result)
Associates the key with the provided result.
Builder<KeyType, ValueType>
setSuccess(KeyType key, ValueType value)
Associates the key with the provided successful return value.

Inherited Method Summary

Public Constructors

public Builder ()

Public Methods

public AppSearchBatchResult<KeyType, ValueType> build ()

Builds an AppSearchBatchResult object from the contents of this AppSearchBatchResult.Builder.

public Builder<KeyType, ValueType> setFailure (KeyType key, int resultCode, 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
key The key to associate the result with; usually corresponds to some identifier from the input like an ID or name.
resultCode One of the constants documented in AppSearchResult.getResultCode().
errorMessage An optional string describing the reason or nature of the failure.

public Builder<KeyType, ValueType> setResult (KeyType key, AppSearchResult<ValueType> result)

Associates the key with the provided result.

Any previous mapping for a key, whether success or failure, is deleted.

Parameters
key The key to associate the result with; usually corresponds to some identifier from the input like an ID or name.
result The result to associate with the key.

public Builder<KeyType, ValueType> setSuccess (KeyType key, 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)).

Parameters
key The key to associate the result with; usually corresponds to some identifier from the input like an ID or name.
value An optional value to associate with the successful result of the operation being performed.