Represents the result of an action that may, or may not, have occurred yet.
Constructor and description |
---|
Future
(java.lang.Object delegate) |
Type | Name and description |
---|---|
java.lang.Throwable |
cause() A Throwable describing failure. |
void |
complete(T result) Set the result. |
void |
complete() Set a null result. |
io.vertx.core.Handler<io.vertx.core.AsyncResult<T>> |
completer() @return
|
Future<U> |
compose(io.vertx.core.Handler<T> handler, Future<U> composed) Compose this future with a provided next future. |
Future<U> |
compose(java.util.function.Function<T, Future<U>> mapper) Compose this future with a mapper function. |
void |
fail(java.lang.Throwable throwable) Set the failure. |
void |
fail(java.lang.String failureMessage) Set the failure. |
boolean |
failed() Did it fail? |
static Future<T> |
failedFuture(java.lang.String failureMessage) Create a failed future with the specified failure message. |
static Future<T> |
future() Create a future that hasn't completed yet |
java.lang.Object |
getDelegate() |
boolean |
isComplete() Has the future completed? |
Future<U> |
map(java.util.function.Function<T, U> mapper) Apply a mapper function on this future. |
Future<V> |
map(V value) Map the result of a future to a specific value . |
T |
result() The result of the operation. |
Future<T> |
setHandler(io.vertx.core.Handler<io.vertx.core.AsyncResult<T>> handler) Set a handler for the result. |
boolean |
succeeded() Did it succeed? |
static Future<T> |
succeededFuture() Create a succeeded future with a null result |
static Future<T> |
succeededFuture(T result) Created a succeeded future with the specified result. |
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() |
A Throwable describing failure. This will be null if the operation succeeded.
Set the result. Any handler will be called, if there is one, and the future will be marked as completed.
result
- the resultSet a null result. Any handler will be called, if there is one, and the future will be marked as completed.
Compose this future with a provided next
future.
When this future succeeds, the handler
will be called with the completed value, this handler
should complete the next future.
If the handler
throws an exception, the returned future will be failed with this exception.
When this future fails, the failure will be propagated to the next
future and the handler
will not be called.
handler
- the handlercomposed
- the composed future Compose this future with a mapper
function.
When this future succeeds, the mapper
will be called with the completed value and this mapper
returns a future. This returned future completion will trigger the future returned by this method call.
If the mapper
throws an exception, the returned future will be failed with this exception.
When this future fails, the failure will be propagated to the returned future and the mapper
will not be called.
mapper
- the mapper functionSet the failure. Any handler will be called, if there is one, and the future will be marked as completed.
throwable
- the failure causeSet the failure. Any handler will be called, if there is one, and the future will be marked as completed.
failureMessage
- the failure messageDid it fail?
Create a failed future with the specified failure message.
failureMessage
- the failure messageCreate a future that hasn't completed yet
Has the future completed?
It's completed if it's either succeeded or failed.
Apply a mapper
function on this future.
When this future succeeds, the mapper
will be called with the completed value and this mapper
returns a value. This value will complete the future returned by this method call.
If the mapper
throws an exception, the returned future will be failed with this exception.
When this future fails, the failure will be propagated to the returned future and the mapper
will not be called.
mapper
- the mapper function Map the result of a future to a specific value
.
When this future succeeds, this value
will complete the future returned by this method call.
When this future fails, the failure will be propagated to the returned future.
value
- the value that eventually completes the mapped futureThe result of the operation. This will be null if the operation failed.
Set a handler for the result.
If the future has already been completed it will be called immediately. Otherwise it will be called when the future is completed.
handler
- the Handler that will be called with the resultDid it succeed?
Create a succeeded future with a null result
Created a succeeded future with the specified result.
result
- the result