@groovy.transform.CompileStatic class PromiseMap extends java.lang.Object
A map-like structure for promises that allows waiting for all values in the map to be populated before executing a callback
Modifiers | Name | Description |
---|---|---|
protected java.util.LinkedHashMap<K, Promise> |
promises |
|
protected java.util.LinkedHashMap<Promise, K> |
promisesKeys |
Constructor and description |
---|
PromiseMap
() |
PromiseMap
(java.util.Map<K, java.lang.Object> values) |
Type | Name and description |
---|---|
boolean |
containsKey(K o) @param o The key |
Promise |
get(K o) Gets a promise instance for the given key |
java.util.Map<K, V> |
get() Synchronously return the populated map with all values obtained from promises used inside the populated map |
java.util.Map<K, V> |
get(long timeout, java.util.concurrent.TimeUnit units) Synchronously return the populated map with all values obtained from promises used inside the populated map |
Promise |
getAt(K o) Gets a promise instance for the given key |
boolean |
isEmpty() @return Whether the map is empty |
Promise<java.util.Map<K, V>> |
leftShift(groovy.lang.Closure callable) |
Promise<java.util.Map<K, V>> |
onComplete(groovy.lang.Closure callable) |
Promise<java.util.Map<K, V>> |
onError(groovy.lang.Closure callable) |
Promise |
put(K k, java.lang.Object value) Put any value and return a promise for that value |
Promise |
put(K k, Promise promise) Adds a promise for the given key |
Promise |
put(K k, groovy.lang.Closure callable) Adds a promise for the given key |
Promise |
putAt(java.lang.String k, Promise promise) Adds a promise for the given key |
Promise |
putAt(java.lang.String k, groovy.lang.Closure promise) Adds a promise for the given key |
Promise |
putAt(java.lang.String k, java.lang.Object value) Adds a promise for the given key |
Promise |
putAt(java.lang.Integer k, Promise promise) Adds a promise for the given key |
Promise |
putAt(java.lang.Integer k, groovy.lang.Closure promise) Adds a promise for the given key |
int |
size() @return The size the map |
Promise<java.util.Map<K, V>> |
then(groovy.lang.Closure callable) |
Methods inherited from class | Name |
---|---|
class java.lang.Object |
java.lang.Object#wait(long, int), java.lang.Object#wait(long), java.lang.Object#wait(), java.lang.Object#equals(java.lang.Object), java.lang.Object#toString(), java.lang.Object#hashCode(), java.lang.Object#getClass(), java.lang.Object#notify(), java.lang.Object#notifyAll() |
o
- The keyGets a promise instance for the given key
o
- The keySynchronously return the populated map with all values obtained from promises used inside the populated map
Synchronously return the populated map with all values obtained from promises used inside the populated map
timeout
- The timeout periodunits
- The timeout unitsGets a promise instance for the given key
o
- The key
Put any value and return a promise for that value
k
- The keyvalue
- The valueAdds a promise for the given key
k
- The keypromise
- The promiseAdds a promise for the given key
k
- The keypromise
- The promiseAdds a promise for the given key
k
- The keypromise
- The promiseAdds a promise for the given key
k
- The keypromise
- The promiseAdds a promise for the given key
k
- The keypromise
- The promiseAdds a promise for the given key
k
- The keypromise
- The promiseAdds a promise for the given key
k
- The keypromise
- The promise