Added in API level 31

AppSearchResult


class AppSearchResult<ValueType : Any!>
kotlin.Any
   ↳ android.app.appsearch.AppSearchResult

Information about the success or failure of an AppSearch call.

Summary

Constants
static Int

The requested operation is denied for the caller.

static Int

An internal error occurred within AppSearch, which the caller cannot address.

static Int

The caller supplied invalid arguments to the call.

static Int

The caller supplied a schema which is invalid or incompatible with the previous schema.

static Int

An issue occurred reading or writing to storage.

static Int

An entity the caller requested to interact with does not exist in the system.

static Int

The call was successful.

static Int

Storage is out of space, and no more space could be reclaimed.

static Int

The caller has hit AppSearch's rate limit and the requested operation has been rejected.

static Int

The caller requested an operation it does not have privileges for.

static Int

The operation was timed out.

static Int

An unknown error occurred while processing the call.

Public methods
Boolean
equals(other: Any?)

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

String?

Returns the error message associated with this result.

Int

Returns one of the RESULT constants defined in AppSearchResult.

ValueType?

Returns the result value associated with this result, if it was successful.

Int

Boolean

Returns true if getResultCode equals AppSearchResult.RESULT_OK.

static AppSearchResult<ValueType>
newFailedResult(resultCode: Int, errorMessage: String?)

Creates a new failed AppSearchResult.

static AppSearchResult<ValueType>
newSuccessfulResult(value: ValueType?)

Creates a new successful AppSearchResult.

String

Returns a string representation of the object.

Constants

RESULT_DENIED

static val RESULT_DENIED: Int

The requested operation is denied for the caller. This error is logged and returned for denylist rejections.

Value: 9

RESULT_INTERNAL_ERROR

Added in API level 31
static val RESULT_INTERNAL_ERROR: Int

An internal error occurred within AppSearch, which the caller cannot address.

This error may be considered similar to IllegalStateException

Value: 2

RESULT_INVALID_ARGUMENT

Added in API level 31
static val RESULT_INVALID_ARGUMENT: Int

The caller supplied invalid arguments to the call.

This error may be considered similar to IllegalArgumentException.

Value: 3

RESULT_INVALID_SCHEMA

Added in API level 31
static val RESULT_INVALID_SCHEMA: Int

The caller supplied a schema which is invalid or incompatible with the previous schema.

Value: 7

RESULT_IO_ERROR

Added in API level 31
static val RESULT_IO_ERROR: Int

An issue occurred reading or writing to storage. The call might succeed if repeated.

This error may be considered similar to java.io.IOException.

Value: 4

RESULT_NOT_FOUND

Added in API level 31
static val RESULT_NOT_FOUND: Int

An entity the caller requested to interact with does not exist in the system.

Value: 6

RESULT_OK

Added in API level 31
static val RESULT_OK: Int

The call was successful.

Value: 0

RESULT_OUT_OF_SPACE

Added in API level 31
static val RESULT_OUT_OF_SPACE: Int

Storage is out of space, and no more space could be reclaimed.

Value: 5

RESULT_RATE_LIMITED

static val RESULT_RATE_LIMITED: Int

The caller has hit AppSearch's rate limit and the requested operation has been rejected. The caller is recommended to reschedule tasks with exponential backoff.

Value: 10

RESULT_SECURITY_ERROR

Added in API level 31
static val RESULT_SECURITY_ERROR: Int

The caller requested an operation it does not have privileges for.

Value: 8

RESULT_TIMED_OUT

static val RESULT_TIMED_OUT: Int

The operation was timed out.

Value: 11

RESULT_UNKNOWN_ERROR

Added in API level 31
static val RESULT_UNKNOWN_ERROR: Int

An unknown error occurred while processing the call.

Value: 1

Public methods

equals

Added in API level 31
fun equals(other: Any?): Boolean

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

The equals method implements an equivalence relation on non-null object references:

  • It is reflexive: for any non-null reference value x, x.equals(x) should return true.
  • It is symmetric: for any non-null reference values x and y, x.equals(y) should return true if and only if y.equals(x) returns true.
  • It is transitive: for any non-null reference values x, y, and z, if x.equals(y) returns true and y.equals(z) returns true, then x.equals(z) should return true.
  • It is consistent: for any non-null reference values x and y, multiple invocations of x.equals(y) consistently return true or consistently return false, provided no information used in equals comparisons on the objects is modified.
  • For any non-null reference value x, x.equals(null) should return false.

An equivalence relation partitions the elements it operates on into equivalence classes; all the members of an equivalence class are equal to each other. Members of an equivalence class are substitutable for each other, at least for some purposes.

Parameters
obj the reference object with which to compare.
other Any?: This value may be null.
Return
Boolean true if this object is the same as the obj argument; false otherwise.

getErrorMessage

Added in API level 31
fun getErrorMessage(): String?

Returns the error message associated with this result.

If isSuccess is true, the error message is always null. The error message may be null even if isSuccess is false. See the documentation of the particular AppSearchSession call producing this AppSearchResult for what is returned by getErrorMessage.

getResultValue

Added in API level 31
fun getResultValue(): ValueType?

Returns the result value associated with this result, if it was successful.

See the documentation of the particular AppSearchSession call producing this AppSearchResult for what is placed in the result value by that call.

Return
ValueType? This value may be null.
Exceptions
java.lang.IllegalStateException if this AppSearchResult is not successful.

hashCode

Added in API level 31
fun hashCode(): Int
Return
Int a hash code value for this object.

isSuccess

Added in API level 31
fun isSuccess(): Boolean

Returns true if getResultCode equals AppSearchResult.RESULT_OK.

newSuccessfulResult

Added in API level 31
static fun <ValueType : Any!> newSuccessfulResult(value: ValueType?): AppSearchResult<ValueType>

Creates a new successful AppSearchResult.

Parameters
value ValueType?: An optional value to associate with the successful result of the operation being performed. This value may be null.
Return
AppSearchResult<ValueType> This value cannot be null.

toString

Added in API level 31
fun toString(): String

Returns a string representation of the object.

Return
String This value cannot be null.