Reakt Reactive Java, Streaming, Promises Lib 2.4.0.RELEASE
·
52 commits
to master
since this release
We closed the following issues.
- 16 utility methods for Promise (replyDone and resolve)
- 15 empty resolve method for and returning null (matches ES6)
- 14 Utility methods for Java basic types.
We need this in both the reactor Promises.
class Promises
/**
* Returns a String promise
* Added to make static imports possible.
*
* @return returns a string promise
*/
static Promise<String> promiseString() {
return new BasePromise<>();
}
/**
* Returns a Integer promise
* Added to make static imports possible.
*
* @return returns an int promise
*/
static Promise<Integer> promiseInt() {
return new BasePromise<>();
}
/**
* Returns a Long promise
* Added to make static imports possible.
*
* @return returns an long promise
*/
static Promise<Long> promiseLong() {
return new BasePromise<>();
}
/**
* Returns a Double promise
* Added to make static imports possible.
*
* @return returns an double promise
*/
static Promise<Double> promiseDouble() {
return new BasePromise<>();
}
/**
* Returns a Float promise
* Added to make static imports possible.
*
* @return returns an float promise
*/
static Promise<Float> promiseFloat() {
return new BasePromise<>();
}
/**
* Returns a void promise for notify of outcome but no value returned.
* <p>
* Callback replyDone can be used instead of replay on service side.
*
* @return void promise
*/
static Promise<Void> promiseNotify() {
return new BasePromise<>();
}
/**
* Boolean promise
* Added to make static imports possible.
*
* @return promises a boolean
*/
static Promise<Boolean> promiseBoolean() {
return new BasePromise<>();
}
/**
* Generic promise.
* Added to make static imports possible.
*
* @param cls type
* @param <T> promise of a result of T
* @return new Promise of type T
*/
@SuppressWarnings("unused")
static <T> Promise<T> promise(Class<T> cls) {
return new BasePromise<>();
}
/**
* Generic list promise.
* Added to make static imports possible.
*
* @param componentType component type of list
* @param <T> promise a list of type T
* @return new Promise for a list of type T
*/
@SuppressWarnings("unused")
static <T> Promise<List<T>> promiseList(Class<T> componentType) {
return new BasePromise<>();
}
/**
* Generic collection promise.
* Added to make static imports possible.
*
* @param componentType component type of collection
* @param <T> promise a collection of type T
* @return new Promise for a collection of type T
*/
@SuppressWarnings("unused")
static <T> Promise<Collection<T>> promiseCollection(Class<T> componentType) {
return new BasePromise<>();
}
/**
* Generic map promise.
* Added to make static imports possible.
*
* @param keyType type of map key
* @param valueType type of map value
* @param <K> promise a map of key type K
* @param <V> promise a map of value type V
* @return new Promise for a collection of type T
*/
@SuppressWarnings("unused")
static <K, V> Promise<Map<K, V>> promiseMap(Class<K> keyType, Class<V> valueType) {
return new BasePromise<>();
}
/**
* Generic set promise.
* Added to make static imports possible.
*
* @param componentType component type of set
* @param <T> promise a set of type T
* @return new Promise for a set of type T
*/
@SuppressWarnings("unused")
static <T> Promise<Set<T>> promiseSet(Class<T> componentType) {
return new BasePromise<>();
}
We also have them for the reactor (methods off of the reactor), and we have them for blocking and replay promises off of Promises utility class. This makes the fluent programming a bit nicer. Especially if you are using static imports of Promises
.