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 io.vertx.lang.rx.TypeArg<Future> |
__TYPE_ARG |
io.vertx.lang.rx.TypeArg<T> |
__typeArg_0 |
Constructor and Description |
---|
Future(Future delegate) |
Future(Object delegate,
io.vertx.lang.rx.TypeArg<T> typeArg_0) |
Modifier and Type | Method and Description |
---|---|
Throwable |
cause()
A Throwable describing failure.
|
void |
complete()
Deprecated.
|
void |
complete(T result)
Deprecated.
|
Handler<AsyncResult<T>> |
completer()
Deprecated.
|
<U> Future<U> |
compose(java.util.function.Function<T,Future<U>> mapper)
Compose this future with a
mapper function. |
<U> Future<U> |
compose(java.util.function.Function<T,Future<U>> successMapper,
java.util.function.Function<Throwable,Future<U>> failureMapper)
Compose this future with a
successMapper and failureMapper functions. |
boolean |
equals(Object o) |
void |
fail(String failureMessage)
Deprecated.
|
void |
fail(Throwable cause)
Deprecated.
|
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.
|
<U> Future<U> |
flatMap(java.util.function.Function<T,Future<U>> mapper)
|
static <T> Future<T> |
future()
Deprecated.
|
static <T> Future<T> |
future(Handler<Promise<T>> handler)
Create a future that hasn't completed yet and that is passed to the
handler before it is returned. |
Future |
getDelegate() |
int |
hashCode() |
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 . |
<V> Future<V> |
mapEmpty()
Map the result of a future to
null . |
static <T> Future<T> |
newInstance(Future arg) |
static <T> Future<T> |
newInstance(Future arg,
io.vertx.lang.rx.TypeArg<T> __typeArg_T) |
Future<T> |
onComplete(Handler<AsyncResult<T>> handler)
Add a handler to be notified of the result.
|
Future<T> |
onFailure(Handler<Throwable> handler)
Add a handler to be notified of the failed result.
|
Future<T> |
onSuccess(Handler<T> handler)
Add a handler to be notified of the succeeded result.
|
Future<T> |
otherwise(java.util.function.Function<Throwable,T> mapper)
Apply a
mapper function on this future. |
Future<T> |
otherwise(T value)
Map the failure of a future to a specific
value . |
Future<T> |
otherwiseEmpty()
Map the failure of a future to
null . |
Future<T> |
recover(java.util.function.Function<Throwable,Future<T>> mapper)
Handles a failure of this Future by returning the result of another Future.
|
T |
result()
The result of the operation.
|
Single<T> |
rxOnComplete()
Add a handler to be notified of the result.
|
Single<T> |
rxSetHandler()
Deprecated.
|
Future<T> |
setHandler(Handler<AsyncResult<T>> handler)
Deprecated.
|
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.
|
String |
toString() |
boolean |
tryComplete()
Deprecated.
|
boolean |
tryComplete(T result)
Deprecated.
|
boolean |
tryFail(String failureMessage)
Deprecated.
|
boolean |
tryFail(Throwable cause)
Deprecated.
|
public static final io.vertx.lang.rx.TypeArg<Future> __TYPE_ARG
public final io.vertx.lang.rx.TypeArg<T> __typeArg_0
public Future(Future delegate)
public Future getDelegate()
public static <T> Future<T> future(Handler<Promise<T>> handler)
handler
before it is returned.handler
- the handler@Deprecated 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.
@Deprecated public Future<T> setHandler(Handler<AsyncResult<T>> handler)
handler
- @Deprecated public Single<T> rxSetHandler()
public Future<T> onComplete(Handler<AsyncResult<T>> handler)
handler
- the handler that will be called with the resultpublic Single<T> rxOnComplete()
public Future<T> onSuccess(Handler<T> handler)
handler
- the handler that will be called with the succeeded resultpublic Future<T> onFailure(Handler<Throwable> handler)
handler
- the handler that will be called with the failed result@Deprecated public void complete(T result)
result
- the result@Deprecated public void complete()
@Deprecated public void fail(Throwable cause)
cause
- the failure cause@Deprecated public void fail(String failureMessage)
failureMessage
- the failure message@Deprecated public boolean tryComplete(T result)
result
- the result@Deprecated public boolean tryComplete()
@Deprecated public boolean tryFail(Throwable cause)
cause
- the failure cause@Deprecated public boolean tryFail(String failureMessage)
failureMessage
- the failure messagepublic T result()
public Throwable cause()
public boolean succeeded()
public boolean failed()
public <U> Future<U> flatMap(java.util.function.Function<T,Future<U>> mapper)
mapper
- public <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> compose(java.util.function.Function<T,Future<U>> successMapper, java.util.function.Function<Throwable,Future<U>> failureMapper)
successMapper
and failureMapper
functions.
When this future (the one on which compose
is called) succeeds, the successMapper
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.
When this future (the one on which compose
is called) fails, the failureMapper
will be called with
the failure and this mapper returns another future object. This returned future completion will complete
the future returned by this method call.
If any mapper function throws an exception, the returned future will be failed with this exception.
successMapper
- the function mapping the successfailureMapper
- the function mapping the failurepublic <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 <V> Future<V> mapEmpty()
null
.
This is a conveniency for future.map((T) null)
or future.map((Void) null)
.
When this future succeeds, null
will complete the future returned by this method call.
When this future fails, the failure will be propagated to the returned future.
@Deprecated public Handler<AsyncResult<T>> completer()
public Future<T> recover(java.util.function.Function<Throwable,Future<T>> mapper)
mapper
- A function which takes the exception of a failure and returns a new future.public Future<T> otherwise(java.util.function.Function<Throwable,T> mapper)
mapper
function on this future.
When this future fails, 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 succeeds, the result will be propagated to the returned future and the mapper
will not be called.
mapper
- the mapper functionpublic Future<T> otherwise(T value)
value
.
When this future fails, this value
will complete the future returned by this method call.
When this future succeeds, the result will be propagated to the returned future.
value
- the value that eventually completes the mapped futurepublic Future<T> otherwiseEmpty()
null
.
This is a convenience for future.otherwise((T) null)
.
When this future fails, the null
value will complete the future returned by this method call.
When this future succeeds, the result will be propagated to the returned future.
Copyright © 2023 Eclipse. All rights reserved.