public class Promises
extends java.lang.Object
Promise
s.
These methods return Promises which use the default callback executor and
default scheduled executor. See PromiseFactory
for similar methods
which use executors other than the default executors.
PromiseFactory
Modifier and Type | Method and Description |
---|---|
static <T,S extends T> |
all(java.util.Collection<Promise<S>> promises)
Returns a new Promise that is a latch on the resolution of the specified
Promises.
|
static <T> Promise<java.util.List<T>> |
all(Promise<? extends T>... promises)
Returns a new Promise that is a latch on the resolution of the specified
Promises.
|
static <T> Promise<T> |
failed(java.lang.Throwable failure)
Returns a new Promise that has been resolved with the specified failure.
|
static <T> Promise<T> |
resolved(T value)
Returns a new Promise that has been resolved with the specified value.
|
public static <T> Promise<T> resolved(T value)
T
- The value type associated with the returned Promise.value
- The value of the resolved Promise.PromiseFactory.resolved(Object)
public static <T> Promise<T> failed(java.lang.Throwable failure)
T
- The value type associated with the returned Promise.failure
- The failure of the resolved Promise. Must not be
null
.PromiseFactory.failed(Throwable)
public static <T,S extends T> Promise<java.util.List<T>> all(java.util.Collection<Promise<S>> promises)
The returned Promise acts as a gate and must be resolved after all of the specified Promises are resolved.
T
- The value type of the List value associated with the returned
Promise.S
- A subtype of the value type of the List value associated with
the returned Promise.promises
- The Promises which must be resolved before the returned
Promise must be resolved. Must not be null
and all of
the elements in the collection must not be null
.FailedPromisesException
if any of the
specified Promises are resolved with a failure. The failure
FailedPromisesException
must contain all of the specified
Promises which resolved with a failure.PromiseFactory.all(Collection)
@SafeVarargs public static <T> Promise<java.util.List<T>> all(Promise<? extends T>... promises)
The new Promise acts as a gate and must be resolved after all of the specified Promises are resolved.
T
- The value type associated with the specified Promises.promises
- The Promises which must be resolved before the returned
Promise must be resolved. Must not be null
and all of
the arguments must not be null
.FailedPromisesException
if any of the specified
Promises are resolved with a failure. The failure
FailedPromisesException
must contain all of the specified
Promises which resolved with a failure.PromiseFactory.all(Collection)
Copyright © 2010 - 2020 Adobe. All Rights Reserved