interface PromiseFactory
An interface capable of creating Promise instances. The Promises static methods use this interface to create promises. The default Promise creation mechanism can be overridden by setting Promises.setPromiseFactory
Type Params | Return Type | Name and description |
---|---|---|
|
abstract void |
addPromiseDecoratorLookupStrategy(PromiseDecoratorLookupStrategy lookupStrategy) Adds a PromiseDecoratorLookupStrategy. |
<T> |
abstract groovy.lang.Closure<T> |
applyDecorators(groovy.lang.Closure<T> c, java.util.List<PromiseDecorator> decorators) Applies the registered decorators to the given closure |
<T> |
abstract Promise<T> |
createBoundPromise(T value) Creates a promise with a value pre-bound to it |
<T> |
abstract Promise<T> |
createPromise(java.lang.Class<T> returnType) Creates an unfulfilled promise that returns the given type |
|
abstract Promise<java.lang.Void> |
createPromise() Creates an unfulfilled promise that returns void |
<K, V> |
abstract Promise<java.util.Map<K, V>> |
createPromise(java.util.Map<K, V> map) Creates a promise from the given map where the values of the map are either closures or Promise instances |
<K, V> |
abstract Promise<java.util.Map<K, V>> |
createPromise(java.util.Map<K, V> map, java.util.List<PromiseDecorator> decorators) Creates a promise from the given map where the values of the map are either closures or Promise instances |
<T> |
abstract Promise<java.util.List<T>> |
createPromise(Promise<T>[] promises) Creates a promise from one or more other promises |
<T> |
abstract Promise<T> |
createPromise(groovy.lang.Closure<T>[] closures) Creates a promise from one or many closures |
<T> |
abstract Promise<T> |
createPromise(groovy.lang.Closure<T> closure, java.util.List<PromiseDecorator> decorators) Creates a promise from one or many closures |
<T> |
abstract Promise<java.util.List<T>> |
createPromise(java.util.List<groovy.lang.Closure<T>> closures, java.util.List<PromiseDecorator> decorators) Creates a promise from one or many closures |
<T> |
abstract Promise<java.util.List<T>> |
createPromise(java.util.List<groovy.lang.Closure<T>> closures) Creates a promise from one or many closures |
<T> |
abstract Promise<java.util.List<T>> |
onComplete(java.util.List<Promise<T>> promises, groovy.lang.Closure<T> callable) Executes the given callback when the list of promises completes |
<T> |
abstract Promise<java.util.List<T>> |
onError(java.util.List<Promise<T>> promises, groovy.lang.Closure<?> callable) Executes the given callback if an error occurs for the list of promises |
<T> |
abstract java.util.List<T> |
waitAll(Promise<T>[] promises) Synchronously waits for all promises to complete returning a list of values |
<T> |
abstract java.util.List<T> |
waitAll(java.util.List<Promise<T>> promises) Synchronously waits for all promises to complete returning a list of values |
<T> |
abstract java.util.List<T> |
waitAll(java.util.List<Promise<T>> promises, long timeout, java.util.concurrent.TimeUnit units) Synchronously waits for all promises to complete returning a list of values |
Adds a PromiseDecoratorLookupStrategy. The strategy implementation must be stateless, do not add a strategy that contains state
lookupStrategy
- The lookup strategyApplies the registered decorators to the given closure
c
- The closuredecorators
- The decoratorsCreates a promise with a value pre-bound to it
value
- The valueT
- The type of the valueCreates an unfulfilled promise that returns the given type
returnType
- The return typeT
- The type of the classCreates an unfulfilled promise that returns void
Creates a promise from the given map where the values of the map are either closures or Promise instances
map
- The mapCreates a promise from the given map where the values of the map are either closures or Promise instances
map
- The mapCreates a promise from one or more other promises
promises
- The promisesCreates a promise from one or many closures
closures
- One or many closuresCreates a promise from one or many closures
closure
- A closureCreates a promise from one or many closures
closures
- One or many closuresCreates a promise from one or many closures
closures
- One or many closuresExecutes the given callback when the list of promises completes
promises
- The promisescallable
- The callback to executeExecutes the given callback if an error occurs for the list of promises
promises
- The promises The promisescallable
- The error callback to executeSynchronously waits for all promises to complete returning a list of values
promises
- The promisesSynchronously waits for all promises to complete returning a list of values
promises
- The promisesSynchronously waits for all promises to complete returning a list of values
promises
- The promises