AppSearchBatchResult


public final class AppSearchBatchResult
extends Object

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


Provides results for AppSearch batch operations which encompass multiple documents.

Individual results of a batch operation are separated into two maps: one for successes and one for failures. For successes, getSuccesses() will return a map of keys to instances of the value type. For failures, getFailures() will return a map of keys to AppSearchResult objects.

Alternatively, getAll() returns a map of keys to AppSearchResult objects for both successes and failures.

Summary

Nested classes

class AppSearchBatchResult.Builder<KeyType, ValueType>

Builder for AppSearchBatchResult objects. 

Public methods

Map<KeyType, AppSearchResult<ValueType>> getAll()

Returns a Map of keys mapped to instances of AppSearchResult for all individual results.

Map<KeyType, AppSearchResult<ValueType>> getFailures()

Returns a Map of keys mapped to instances of AppSearchResult for all failed individual results.

Map<KeyType, ValueType> getSuccesses()

Returns a Map of keys mapped to instances of the value type for all successful individual results.

boolean isSuccess()

Returns true if this AppSearchBatchResult has no failures.

String toString()

Returns a string representation of the object.

Inherited methods

Object clone()

Creates and returns a copy of this object.

boolean equals(Object obj)

Indicates whether some other object is "equal to" this one.

void finalize()

Called by the garbage collector on an object when garbage collection determines that there are no more references to the object.

final Class<?> getClass()

Returns the runtime class of this Object.

int hashCode()

Returns a hash code value for the object.

final void notify()

Wakes up a single thread that is waiting on this object's monitor.

final void notifyAll()

Wakes up all threads that are waiting on this object's monitor.

String toString()

Returns a string representation of the object.

final void wait(long timeoutMillis, int nanos)

Causes the current thread to wait until it is awakened, typically by being notified or interrupted, or until a certain amount of real time has elapsed.

final void wait(long timeoutMillis)

Causes the current thread to wait until it is awakened, typically by being notified or interrupted, or until a certain amount of real time has elapsed.

final void wait()

Causes the current thread to wait until it is awakened, typically by being notified or interrupted.

Public methods

getAll

Added in API level 31
public Map<KeyType, AppSearchResult<ValueType>> getAll ()

Returns a Map of keys mapped to instances of AppSearchResult for all individual results.

The values of the Map will not be null.

Returns
Map<KeyType, AppSearchResult<ValueType>>

getFailures

Added in API level 31
public Map<KeyType, AppSearchResult<ValueType>> getFailures ()

Returns a Map of keys mapped to instances of AppSearchResult for all failed individual results.

The values of the Map will not be null.

Returns
Map<KeyType, AppSearchResult<ValueType>>

getSuccesses

Added in API level 31
public Map<KeyType, ValueType> getSuccesses ()

Returns a Map of keys mapped to instances of the value type for all successful individual results.

Example: AppSearchSession.getByDocumentId returns an AppSearchBatchResult. Each key (the document ID, of String type) will map to a GenericDocument object.

The values of the Map will not be null.

Returns
Map<KeyType, ValueType>

isSuccess

Added in API level 31
public boolean isSuccess ()

Returns true if this AppSearchBatchResult has no failures.

Returns
boolean

toString

Added in API level 31
public String toString ()

Returns a string representation of the object.

Returns
String This value cannot be null.