public final class Promises
extends java.lang.Object
Promise.
Provides various methods for creating promises.| Modifier and Type | Method and Description |
|---|---|
static <T> Promise<T> |
create(Scheduler scheduler,
Action<T> onScheduleAction)
Returns a promise scheduled to be resolved by the specified action.
|
static <T> Promise<T> |
error(java.lang.Throwable error)
Returns a new promise which wraps the provided error.
|
static <T> Promise<T> |
promise()
Returns a new unresolved promise.
|
static <T> Promise<T> |
value(T value)
Returns a new promise which wraps the provided value.
|
public static <T> Promise<T> create(Scheduler scheduler, Action<T> onScheduleAction)
T - The type of the value promised to be available now, or in the future, or never.scheduler - The scheduler to call the action.onScheduleAction - The action to resolve the provided promise.public static <T> Promise<T> promise()
T - The type of the value promised to be available now, or in the future, or never.public static <T> Promise<T> value(T value)
T - The type of the value promised to be available now, or in the future, or never.value - The value to lift into a promise.public static <T> Promise<T> error(java.lang.Throwable error)
T - The type of the value promised to be available now, or in the future, or never.error - The error to lift into a promise.