AppSearchBatchResult.Builder

public static final class AppSearchBatchResult.Builder
extends Object

java.lang.Object
   ↳ androidx.appsearch.app.AppSearchBatchResult.Builder<KeyType, ValueType>


Builder for AppSearchBatchResult objects.

Once build() is called, the instance can no longer be used.

Summary

Public constructors

Builder()

Public methods

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 result)

Associates the key with the provided successful return value.

Inherited methods

Public constructors

Builder

public Builder ()

Public methods

build

public AppSearchBatchResult<KeyType, ValueType> build ()

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

Returns
AppSearchBatchResult<KeyType, ValueType>

Throws
IllegalStateException if the builder has already been used.

setFailure

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.

Parameters
key KeyType

resultCode int

errorMessage String

Returns
Builder<KeyType, ValueType>

Throws
IllegalStateException if the builder has already been used.

setResult

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 KeyType

result AppSearchResult

Returns
Builder<KeyType, ValueType>

Throws
IllegalStateException if the builder has already been used.

setSuccess

public Builder<KeyType, ValueType> setSuccess (KeyType key, 
                ValueType result)

Associates the key with the provided successful return value.

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

Parameters
key KeyType

result ValueType

Returns
Builder<KeyType, ValueType>

Throws
IllegalStateException if the builder has already been used.