public final class

AppSearchBatchResult.Builder<KeyType, ValueType>

extends java.lang.Object

 java.lang.Object

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

Overview

Builder for AppSearchBatchResult objects.

Summary

Constructors
publicBuilder()

Methods
public AppSearchBatchResult<java.lang.Object, java.lang.Object>build()

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

public AppSearchBatchResult.Builder<java.lang.Object, java.lang.Object>setFailure(java.lang.Object key, int resultCode, java.lang.String errorMessage)

Associates the key with the provided failure code and error message.

public AppSearchBatchResult.Builder<java.lang.Object, java.lang.Object>setResult(java.lang.Object key, AppSearchResult<java.lang.Object> result)

Associates the key with the provided result.

public AppSearchBatchResult.Builder<java.lang.Object, java.lang.Object>setSuccess(java.lang.Object key, java.lang.Object value)

Associates the key with the provided successful return value.

from java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Constructors

public Builder()

Methods

public AppSearchBatchResult.Builder<java.lang.Object, java.lang.Object> setSuccess(java.lang.Object key, java.lang.Object 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.

public AppSearchBatchResult.Builder<java.lang.Object, java.lang.Object> setFailure(java.lang.Object key, int resultCode, java.lang.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 AppSearchBatchResult.Builder<java.lang.Object, java.lang.Object> setResult(java.lang.Object key, AppSearchResult<java.lang.Object> 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 AppSearchBatchResult<java.lang.Object, java.lang.Object> build()

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