public class Promises extends Object
Promise
s.Modifier and Type | Method and Description |
---|---|
static <T> Promise<T> |
error(Throwable error)
Creates a new promise that is already resolved with the given error.
|
static <T> void |
propagateResult(Promise<T> source,
Settable<T> dest)
Copies the value or error from the source promise to the destination
promise.
|
static <T> void |
propagateResult(Promise<T> source,
SettablePromise<T> dest) |
static <T> SettablePromise<T> |
settable()
Returns a new promise that can have its value set at a later time.
|
static <T> Try<T> |
toTry(Promise<T> promise)
Returns instance of
Try that represents result a promise has completed with. |
static <T> Promise<T> |
value(T value)
Creates a new promise that is already resolved with the given value.
|
public static <T> Promise<T> value(T value)
T
- the type of the value for the promisevalue
- the value for the new promisepublic static <T> Promise<T> error(Throwable error)
T
- the type of the value for the promiseerror
- the error for the new promisepublic static <T> SettablePromise<T> settable()
T
- the type of the value for the promisepublic static <T> void propagateResult(Promise<T> source, Settable<T> dest)
T
- the value type for both promisessource
- the source promisedest
- the destination promisepublic static <T> void propagateResult(Promise<T> source, SettablePromise<T> dest)
public static <T> Try<T> toTry(Promise<T> promise)
Try
that represents result a promise has completed with.
This method throws PromiseUnresolvedException
if teh promise has not been resolved yet.Copyright © 2018. All rights reserved.