AppSearchResult

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

const Int

The requested operation is denied for the caller.

const Int

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

const Int

The caller supplied invalid arguments to the call.

const Int

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

const Int

An issue occurred reading or writing to storage.

const Int

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

const Int

The call was successful.

const Int

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

const Int

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

const Int

An unknown error occurred while processing the call.

Public functions

Boolean
equals(other: Any?)
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 RESULT_OK.

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

Creates a new failed AppSearchResult.

java-static AppSearchResult<ValueType!>
<ValueType> newSuccessfulResult(value: ValueType?)

Creates a new successful AppSearchResult.

String

Constants

RESULT_DENIED

Added in 1.1.0-alpha04
const val RESULT_DENIED = 9: Int

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-alpha04
const val RESULT_INTERNAL_ERROR = 2: Int

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-alpha04
const val RESULT_INVALID_ARGUMENT = 3: Int

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

RESULT_INVALID_SCHEMA

Added in 1.1.0-alpha04
const val RESULT_INVALID_SCHEMA = 7: Int

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

RESULT_IO_ERROR

Added in 1.1.0-alpha04
const val RESULT_IO_ERROR = 4: 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.

RESULT_NOT_FOUND

Added in 1.1.0-alpha04
const val RESULT_NOT_FOUND = 6: Int

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

RESULT_OK

Added in 1.1.0-alpha04
const val RESULT_OK = 0: Int

The call was successful.

RESULT_OUT_OF_SPACE

Added in 1.1.0-alpha04
const val RESULT_OUT_OF_SPACE = 5: Int

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

RESULT_SECURITY_ERROR

Added in 1.1.0-alpha04
const val RESULT_SECURITY_ERROR = 8: Int

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

RESULT_UNKNOWN_ERROR

Added in 1.1.0-alpha04
const val RESULT_UNKNOWN_ERROR = 1: Int

An unknown error occurred while processing the call.

Public functions

equals

fun equals(other: Any?): Boolean

getErrorMessage

Added in 1.1.0-alpha04
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.

getResultCode

Added in 1.1.0-alpha04
fun getResultCode(): Int

Returns one of the RESULT constants defined in AppSearchResult.

getResultValue

Added in 1.1.0-alpha04
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.

Throws
java.lang.IllegalStateException

if this AppSearchResult is not successful.

hashCode

fun hashCode(): Int

isSuccess

Added in 1.1.0-alpha04
fun isSuccess(): Boolean

Returns true if getResultCode equals RESULT_OK.

newFailedResult

Added in 1.1.0-alpha04
java-static fun <ValueType> newFailedResult(resultCode: Int, errorMessage: String?): AppSearchResult<ValueType!>

Creates a new failed AppSearchResult.

Parameters
resultCode: Int

One of the constants documented in getResultCode.

errorMessage: String?

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

newSuccessfulResult

Added in 1.1.0-alpha04
java-static fun <ValueType> 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.

toString

fun toString(): String