Docs Menu

Docs HomeDevelop ApplicationsAtlas Device SDKs

Class App.Result

On this page

  • io.realm.mongodb
  • Method Summary
  • Inherited Methods
  • Method Detail
  • get
  • getError
  • getOrDefault
  • getOrThrow
  • isSuccess
  • success
  • withError
  • withResult
io.realm.mongodb.App.Result

Enclosing class:

App

Result class representing the result of an async request from this app towards MongoDB Realm.

Tip

See also:

  • Callback

Modifier and Type
Method and Description
public T
get ()

Returns the response in case the request was a success.

Returns the error in case of a failed request.

public T
T defaultValue
)

Returns the response if the request was a success.

public T

If the request was successful the response is returned, otherwise the provided error is thrown.

public boolean

Returns whether or not request was successful

public static App.Result
success <T >()

Creates a successful request result with no return value.

public static App.Result
withError <T >(
AppException exception
)

Creates a failed request result.

public static App.Result
T result
)

Creates a successful request result with a return value.

  • Methods inherited from class java.lang.Object : getClass , hashCode , equals , clone , toString , notify , notifyAll , wait , wait , wait , finalize

public T get ()

Returns the response in case the request was a success.

Returns

the response value in case of a successful request.

Returns the error in case of a failed request.

Returns

the AppException in case of a failed request.

public T getOrDefault (
T defaultValue
)

Returns the response if the request was a success. If it failed, the default value is returned instead.

Returns

the response value in case of a successful request. If the request failed, the default value is returned instead.

public T getOrThrow ()

If the request was successful the response is returned, otherwise the provided error is thrown.

Returns

the response object in case the request was a success.

Throws

public boolean isSuccess ()

Returns whether or not request was successful

Returns

true if the request was a success, false if not.

public static App.Result success <T >()

Creates a successful request result with no return value.
public static App.Result withError <T >(
AppException exception
)

Creates a failed request result. The request failed for some reason, either because there was a network error or the Realm Object Server returned an error.

Parameters

  • exception - error that occurred.

public static App.Result withResult <T >(
T result
)

Creates a successful request result with a return value.

Parameters

  • result - the result value.

← Interface App.Callback