class FxaResult<T>
(source)
FxaResult is a class that represents an asynchronous result.
Parameters
interface OnExceptionListener<V>
An interface used to deliver exceptions to listeners of a FxaResult |
|
interface OnValueListener<T, U>
An interface used to deliver values to listeners of a FxaResult |
FxaResult()
FxaResult is a class that represents an asynchronous result. |
fun complete(value: T): Unit
This completes the result with the specified value. IllegalStateException is thrown if the result is already complete. |
|
fun completeExceptionally(exception: Exception): Unit
This completes the result with the specified Exception. IllegalStateException is thrown if the result is already complete. |
|
fun <U> then(fn: (value: T) -> FxaResult<U>?): FxaResult<U>
Adds a value listener to be called when the FxaResult is completed with a value. Listeners will be invoked on the same thread in which the FxaResult was completed. fun <U> then(vfn: (value: T) -> FxaResult<U>?, efn: (Exception) -> FxaResult<U>?): FxaResult<U> fun <U> then(valueListener: OnValueListener<T, U>, exceptionListener: OnExceptionListener<U>?): FxaResult<U>
Adds listeners to be called when the FxaResult is completed either with a value or Exception. Listeners will be invoked on the same thread in which the FxaResult was completed. |
|
fun whenComplete(fn: (value: T) -> Unit): Unit
Adds a value listener to be called when the FxaResult and the whole chain of then calls is completed with a value. Listeners will be invoked on the same thread in which the FxaResult was completed. |
fun <T> fromException(exception: Exception): FxaResult<T>
This constructs a result that is completed with the specified Exception. May not be null. |
|
fun <U> fromValue(value: U): FxaResult<U>
This constructs a result that is fulfilled with the specified value. |