public class Future<T> extends Object
NOTE: This class has been automatically generated from the
original
non RX-ified interface using Vert.x codegen.Modifier and Type | Field and Description |
---|---|
static TypeArg<Future> |
__TYPE_ARG |
TypeArg<T> |
__typeArg_0 |
Constructor and Description |
---|
Future(Future delegate) |
Future(Future delegate,
TypeArg<T> typeArg_0) |
Modifier and Type | Method and Description |
---|---|
Throwable |
cause()
A Throwable describing failure.
|
void |
complete()
Set a null result.
|
void |
complete(T result)
Set the result.
|
Handler<AsyncResult<T>> |
completer() |
<U> Future<U> |
compose(java.util.function.Function<T,Future<U>> mapper)
Compose this future with a
mapper function. |
<U> Future<U> |
compose(Handler<T> handler,
Future<U> next)
Compose this future with a provided
next future. |
void |
fail(String failureMessage)
Set the failure.
|
void |
fail(Throwable throwable)
Set the failure.
|
boolean |
failed()
Did it fail?
|
static <T> Future<T> |
failedFuture(String failureMessage)
Create a failed future with the specified failure message.
|
static <T> Future<T> |
failedFuture(Throwable t)
Create a failed future with the specified failure cause.
|
static <T> Future<T> |
future()
Create a future that hasn't completed yet
|
Future |
getDelegate() |
boolean |
isComplete()
Has the future completed?
|
<U> Future<U> |
map(java.util.function.Function<T,U> mapper)
Apply a
mapper function on this future. |
<V> Future<V> |
map(V value)
Map the result of a future to a specific
value . |
static <T> Future |
newInstance(Future arg) |
static <T> Future |
newInstance(Future arg,
TypeArg<T> __typeArg_T) |
T |
result()
The result of the operation.
|
rx.Single<T> |
rxSetHandler()
Set a handler for the result.
|
Future<T> |
setHandler(Handler<AsyncResult<T>> handler)
Set a handler for the result.
|
rx.Observable<T> |
setHandlerObservable()
Deprecated.
use
rxSetHandler() instead |
boolean |
succeeded()
Did it succeed?
|
static <T> Future<T> |
succeededFuture()
Create a succeeded future with a null result
|
static <T> Future<T> |
succeededFuture(T result)
Created a succeeded future with the specified result.
|
public Future(Future delegate)
public Future getDelegate()
public static <T> Future<T> future()
public static <T> Future<T> succeededFuture()
public static <T> Future<T> succeededFuture(T result)
result
- the resultpublic static <T> Future<T> failedFuture(Throwable t)
t
- the failure cause as a Throwablepublic static <T> Future<T> failedFuture(String failureMessage)
failureMessage
- the failure messagepublic boolean isComplete()
It's completed if it's either succeeded or failed.
public Future<T> setHandler(Handler<AsyncResult<T>> handler)
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 result@Deprecated public rx.Observable<T> setHandlerObservable()
rxSetHandler()
insteadIf the future has already been completed it will be called immediately. Otherwise it will be called when the future is completed.
public rx.Single<T> rxSetHandler()
If the future has already been completed it will be called immediately. Otherwise it will be called when the future is completed.
public void complete(T result)
result
- the resultpublic void complete()
public void fail(Throwable throwable)
throwable
- the failure causepublic void fail(String failureMessage)
failureMessage
- the failure messagepublic T result()
public Throwable cause()
public boolean succeeded()
public boolean failed()
public <U> Future<U> compose(Handler<T> handler, Future<U> next)
next
future.
When this (the one on which compose
is called) 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 handlernext
- the next futurepublic <U> Future<U> compose(java.util.function.Function<T,Future<U>> mapper)
mapper
function.
When this future (the one on which compose
is called) succeeds, the mapper
will be called with
the completed value and this mapper returns another future object. This returned future completion 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 functionpublic <U> Future<U> map(java.util.function.Function<T,U> mapper)
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 functionpublic <V> Future<V> map(V value)
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 futurepublic Handler<AsyncResult<T>> completer()
Copyright © 2017. All rights reserved.