AppSearchResult


public final class AppSearchResult<ValueType>


Information about the success or failure of an AppSearch call.

Parameters
<ValueType>

The type of result object for successful calls.

Summary

Constants

static final int

The operation is invalid because the resource already exists and can't be replaced.

static final int

The requested operation is denied for the caller.

static final int

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

static final int

The caller supplied invalid arguments to the call.

static final int

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

static final int

An issue occurred reading or writing to storage.

static final int

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

static final int

The call was successful.

static final int

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

static final int

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

static final int

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

static final int

The operation was timed out.

static final int

An unknown error occurred while processing the call.

Public methods

boolean
@Nullable String

Returns the error message associated with this result.

int

Returns one of the RESULT constants defined in AppSearchResult.

@Nullable ValueType

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

int
boolean

Returns true if getResultCode equals RESULT_OK.

static @NonNull AppSearchResult<ValueType>
<ValueType> newFailedResult(int resultCode, @Nullable String errorMessage)

Creates a new failed AppSearchResult.

static @NonNull AppSearchResult<ValueType>
<ValueType> newSuccessfulResult(@Nullable ValueType value)

Creates a new successful AppSearchResult.

@NonNull String

Constants

RESULT_ALREADY_EXISTS

Added in 1.1.0-alpha06
public static final int RESULT_ALREADY_EXISTS = 12

The operation is invalid because the resource already exists and can't be replaced.

RESULT_DENIED

Added in 1.1.0-alpha06
public static final int RESULT_DENIED = 9

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

RESULT_INTERNAL_ERROR

Added in 1.1.0-alpha06
public static final int RESULT_INTERNAL_ERROR = 2

An internal error occurred within AppSearch, which the caller cannot address. This error may be considered similar to IllegalStateException

RESULT_INVALID_ARGUMENT

Added in 1.1.0-alpha06
public static final int RESULT_INVALID_ARGUMENT = 3

The caller supplied invalid arguments to the call. This error may be considered similar to IllegalArgumentException.

RESULT_INVALID_SCHEMA

Added in 1.1.0-alpha06
public static final int RESULT_INVALID_SCHEMA = 7

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

RESULT_IO_ERROR

Added in 1.1.0-alpha06
public static final int RESULT_IO_ERROR = 4

An issue occurred reading or writing to storage. The call might succeed if repeated. This error may be considered similar to java.io.IOException.

RESULT_NOT_FOUND

Added in 1.1.0-alpha06
public static final int RESULT_NOT_FOUND = 6

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

RESULT_OK

Added in 1.1.0-alpha06
public static final int RESULT_OK = 0

The call was successful.

RESULT_OUT_OF_SPACE

Added in 1.1.0-alpha06
public static final int RESULT_OUT_OF_SPACE = 5

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

RESULT_RATE_LIMITED

Added in 1.1.0-alpha06
public static final int RESULT_RATE_LIMITED = 10

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.

RESULT_SECURITY_ERROR

Added in 1.1.0-alpha06
public static final int RESULT_SECURITY_ERROR = 8

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

RESULT_TIMED_OUT

Added in 1.1.0-alpha06
public static final int RESULT_TIMED_OUT = 11

The operation was timed out.

RESULT_UNKNOWN_ERROR

Added in 1.1.0-alpha06
public static final int RESULT_UNKNOWN_ERROR = 1

An unknown error occurred while processing the call.

Public methods

equals

public boolean equals(@Nullable Object other)

getErrorMessage

Added in 1.1.0-alpha06
public @Nullable String getErrorMessage()

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.

getResultCode

Added in 1.1.0-alpha06
public int getResultCode()

Returns one of the RESULT constants defined in AppSearchResult.

getResultValue

Added in 1.1.0-alpha06
public @Nullable ValueType getResultValue()

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.

Throws
java.lang.IllegalStateException

if this AppSearchResult is not successful.

hashCode

public int hashCode()

isSuccess

Added in 1.1.0-alpha06
public boolean isSuccess()

Returns true if getResultCode equals RESULT_OK.

newFailedResult

Added in 1.1.0-alpha06
public static @NonNull AppSearchResult<ValueType> <ValueType> newFailedResult(int resultCode, @Nullable String errorMessage)

Creates a new failed AppSearchResult.

Parameters
int resultCode

One of the constants documented in getResultCode.

@Nullable String errorMessage

An optional string describing the reason or nature of the failure.

newSuccessfulResult

Added in 1.1.0-alpha06
public static @NonNull AppSearchResult<ValueType> <ValueType> newSuccessfulResult(@Nullable ValueType value)

Creates a new successful AppSearchResult.

Parameters
@Nullable ValueType value

An optional value to associate with the successful result of the operation being performed.

toString

public @NonNull String toString()