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 |
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 requested an operation it does not have privileges for. |
static Int |
An unknown error occurred while processing the call. |
Public methods | |
---|---|
Boolean |
Indicates whether some other object is "equal to" this one. |
String? |
Returns the error message associated with this result. |
Int |
Returns one of the |
ValueType? |
Returns the result value associated with this result, if it was successful. |
Int |
hashCode() |
Boolean |
Returns |
static AppSearchResult<ValueType> |
newFailedResult(resultCode: Int, errorMessage: String?) Creates a new failed |
static AppSearchResult<ValueType> |
newSuccessfulResult(value: ValueType?) Creates a new successful |
String |
toString() Returns a string representation of the object. |
Constants
RESULT_INTERNAL_ERROR
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
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
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
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
static val RESULT_NOT_FOUND: Int
An entity the caller requested to interact with does not exist in the system.
Value: 6
RESULT_OUT_OF_SPACE
static val RESULT_OUT_OF_SPACE: Int
Storage is out of space, and no more space could be reclaimed.
Value: 5
RESULT_SECURITY_ERROR
static val RESULT_SECURITY_ERROR: Int
The caller requested an operation it does not have privileges for.
Value: 8
RESULT_UNKNOWN_ERROR
static val RESULT_UNKNOWN_ERROR: Int
An unknown error occurred while processing the call.
Value: 1
Public methods
equals
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 returntrue
. - It is symmetric: for any non-null reference values
x
andy
,x.equals(y)
should returntrue
if and only ify.equals(x)
returnstrue
. - It is transitive: for any non-null reference values
x
,y
, andz
, ifx.equals(y)
returnstrue
andy.equals(z)
returnstrue
, thenx.equals(z)
should returntrue
. - It is consistent: for any non-null reference values
x
andy
, multiple invocations ofx.equals(y)
consistently returntrue
or consistently returnfalse
, provided no information used inequals
comparisons on the objects is modified. - For any non-null reference value
x
,x.equals(null)
should returnfalse
.
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
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
fun getResultCode(): Int
Returns one of the RESULT
constants defined in AppSearchResult
.
Return | |
---|---|
Int |
Value is android.app.appsearch.AppSearchResult#RESULT_OK , android.app.appsearch.AppSearchResult#RESULT_UNKNOWN_ERROR , android.app.appsearch.AppSearchResult#RESULT_INTERNAL_ERROR , android.app.appsearch.AppSearchResult#RESULT_INVALID_ARGUMENT , android.app.appsearch.AppSearchResult#RESULT_IO_ERROR , android.app.appsearch.AppSearchResult#RESULT_OUT_OF_SPACE , android.app.appsearch.AppSearchResult#RESULT_NOT_FOUND , android.app.appsearch.AppSearchResult#RESULT_INVALID_SCHEMA , android.app.appsearch.AppSearchResult#RESULT_SECURITY_ERROR , android.app.appsearch.AppSearchResult.RESULT_DENIED, android.app.appsearch.AppSearchResult.RESULT_RATE_LIMITED, or android.app.appsearch.AppSearchResult.RESULT_TIMED_OUT |
getResultValue
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. |
isSuccess
fun isSuccess(): Boolean
Returns true
if getResultCode
equals AppSearchResult#RESULT_OK
.
newFailedResult
static fun <ValueType : Any!> newFailedResult(
resultCode: Int,
errorMessage: String?
): AppSearchResult<ValueType>
Creates a new failed AppSearchResult
.
Parameters | |
---|---|
resultCode |
Int: One of the constants documented in AppSearchResult#getResultCode . Value is android.app.appsearch.AppSearchResult#RESULT_OK , android.app.appsearch.AppSearchResult#RESULT_UNKNOWN_ERROR , android.app.appsearch.AppSearchResult#RESULT_INTERNAL_ERROR , android.app.appsearch.AppSearchResult#RESULT_INVALID_ARGUMENT , android.app.appsearch.AppSearchResult#RESULT_IO_ERROR , android.app.appsearch.AppSearchResult#RESULT_OUT_OF_SPACE , android.app.appsearch.AppSearchResult#RESULT_NOT_FOUND , android.app.appsearch.AppSearchResult#RESULT_INVALID_SCHEMA , android.app.appsearch.AppSearchResult#RESULT_SECURITY_ERROR , android.app.appsearch.AppSearchResult.RESULT_DENIED, android.app.appsearch.AppSearchResult.RESULT_RATE_LIMITED, or android.app.appsearch.AppSearchResult.RESULT_TIMED_OUT |
errorMessage |
String?: An optional string describing the reason or nature of the failure. This value may be null . |
Return | |
---|---|
AppSearchResult<ValueType> |
This value cannot be null . |
newSuccessfulResult
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
fun toString(): String
Returns a string representation of the object.
Return | |
---|---|
String |
This value cannot be null . |