Package com.codingchili.core.context
Class FutureHelper
java.lang.Object
com.codingchili.core.context.FutureHelper
Helper method to simplify working with handlers and asyncresult.
-
Method Summary
Modifier and TypeMethodDescriptionstatic <T> io.vertx.core.Future<T>
Creates a failed future from a throwable.static <T> io.vertx.core.Future<T>
result()
Creates a succeeded future with an empty result.static <T> io.vertx.core.Future<T>
result(T value)
Creates a succeeded future from the given value.static <T> io.vertx.core.Promise<T>
untyped(io.vertx.core.Promise<?> typed)
Converts the given untyped feature into an inferred type by wrapping.
-
Method Details
-
error
Creates a failed future from a throwable.- Type Parameters:
T
- inferred future type- Parameters:
e
- the cause of the failure.- Returns:
- a failed future with the given cause.
-
result
public static <T> io.vertx.core.Future<T> result(T value)Creates a succeeded future from the given value.- Type Parameters:
T
- inferred future type- Parameters:
value
- the value that is the result- Returns:
- a succeeded future with the given value.
-
result
public static <T> io.vertx.core.Future<T> result()Creates a succeeded future with an empty result.- Type Parameters:
T
- inferred future type- Returns:
- a succeeded future with an empty result.
-
untyped
public static <T> io.vertx.core.Promise<T> untyped(io.vertx.core.Promise<?> typed)Converts the given untyped feature into an inferred type by wrapping.- Type Parameters:
T
- inferred future type- Parameters:
typed
- future of any type- Returns:
- a generic future with a handler set.
-