@Dependent public class Promises extends Object
Modifier and Type | Class and Description |
---|---|
static class |
Promises.Error<T> |
Constructor and Description |
---|
Promises() |
Modifier and Type | Method and Description |
---|---|
<T,O> elemental2.promise.Promise<O> |
all(List<T> objects,
Function<T,elemental2.promise.Promise<O>> f)
Maps the objects to Promises using the provided function then behaves just like
all(elemental2.promise.Promise<O>...) . |
<O> elemental2.promise.Promise<O> |
all(elemental2.promise.Promise<O>... promises)
Returns a resolved Promise when every Promise in the list is resolved.
|
<V,T> elemental2.promise.Promise<T> |
catchOrExecute(Object o,
Function<RuntimeException,elemental2.promise.Promise<T>> catchBlock,
Function<V,elemental2.promise.Promise<T>> expectedRejectionHandler)
To be used inside
Promise.catch_(elemental2.promise.Promise.CatchOnRejectedCallbackFn<? extends V>) blocks. |
<T> elemental2.promise.Promise<T> |
create(elemental2.promise.Promise.PromiseExecutorCallbackFn<T> executor) |
void |
init() |
<T,S> elemental2.promise.Promise<S> |
promisify(org.jboss.errai.common.client.api.Caller<T> caller,
Consumer<T> call)
Promisifies a
Caller remote call. |
<T,S> elemental2.promise.Promise<S> |
promisify(org.jboss.errai.common.client.api.Caller<T> caller,
Function<T,S> call)
Promisifies a
Caller remote call. |
<T,O> elemental2.promise.Promise<O> |
reduceLazily(List<T> objects,
Function<T,elemental2.promise.Promise<O>> f)
Maps the objects to Promises using the provided function but only execute the Promises when the
previous Promise is resolved.
|
<T,O> elemental2.promise.Promise<O> |
reduceLazilyChaining(List<T> objects,
BiFunction<Supplier<elemental2.promise.Promise<O>>,T,elemental2.promise.Promise<O>> f)
Behaves just like
reduceLazily(java.util.List<T>, java.util.function.Function<T, elemental2.promise.Promise<O>>) but exposes a reference to the Promise chain as a
parameter to the mapping function. |
<T> elemental2.promise.Promise<T> |
reject(Object object) |
<T> elemental2.promise.Promise<T> |
resolve() |
<T> elemental2.promise.Promise<T> |
resolve(T object) |
@PostConstruct public void init()
@SafeVarargs public final <O> elemental2.promise.Promise<O> all(elemental2.promise.Promise<O>... promises)
public <T,O> elemental2.promise.Promise<O> all(List<T> objects, Function<T,elemental2.promise.Promise<O>> f)
all(elemental2.promise.Promise<O>...)
.public <T,O> elemental2.promise.Promise<O> reduceLazily(List<T> objects, Function<T,elemental2.promise.Promise<O>> f)
public <T,O> elemental2.promise.Promise<O> reduceLazilyChaining(List<T> objects, BiFunction<Supplier<elemental2.promise.Promise<O>>,T,elemental2.promise.Promise<O>> f)
reduceLazily(java.util.List<T>, java.util.function.Function<T, elemental2.promise.Promise<O>>)
but exposes a reference to the Promise chain as a
parameter to the mapping function.public <T,S> elemental2.promise.Promise<S> promisify(org.jboss.errai.common.client.api.Caller<T> caller, Function<T,S> call)
Caller
remote call. If an exception is thrown inside the call function, the
resulting Promise is rejected with a Promises.Error
instance.public <T,S> elemental2.promise.Promise<S> promisify(org.jboss.errai.common.client.api.Caller<T> caller, Consumer<T> call)
Caller
remote call. If an exception is thrown inside the call function, the
resulting Promise is rejected with a Promises.Error
instance.public <V,T> elemental2.promise.Promise<T> catchOrExecute(Object o, Function<RuntimeException,elemental2.promise.Promise<T>> catchBlock, Function<V,elemental2.promise.Promise<T>> expectedRejectionHandler)
Promise.catch_(elemental2.promise.Promise.CatchOnRejectedCallbackFn<? extends V>)
blocks. Decides whether to process a RuntimeException that
caused a prior Promise rejection or to process an expected object rejected by a prior Promise. To proceed
with default error handlers, reject the untreated exception inside the catchBlock function.public <T> elemental2.promise.Promise<T> resolve()
public <T> elemental2.promise.Promise<T> resolve(T object)
public <T> elemental2.promise.Promise<T> reject(Object object)
public <T> elemental2.promise.Promise<T> create(elemental2.promise.Promise.PromiseExecutorCallbackFn<T> executor)
Copyright © 2012–2019 JBoss by Red Hat. All rights reserved.