Top Description Fields Constructors Methods
io.vertx.core.impl.future

public final Class FailedFuture<T>

extends FutureBase<T>
Class Inheritance
Imports
io.vertx.core.AsyncResult, .Future, .Handler, io.vertx.core.impl.ContextInternal, .NoStackTraceThrowable, java.util.function.Function

Failed future implementation.
Author
Julien Viet

Field Summary

Modifier and TypeField and Description
private final Throwable
Inherited from io.vertx.core.impl.future.FutureBase:
context

Constructor Summary

AccessConstructor and Description
public
FailedFuture(Throwable
the throwable
t
)

Create a future that has already failed

public
FailedFuture(ContextInternal context, Throwable
the throwable
t
)

Create a future that has already failed

public
FailedFuture(String
the failure message
failureMessage
)

Create a future that has already failed

public
FailedFuture(ContextInternal context, String
the failure message
failureMessage
)

Create a future that has already failed

Method Summary

Modifier and TypeMethod and Description
public void
addListener(Listener<T>
the listener
listener
)

Implements io.vertx.core.impl.future.FutureInternal.addListener.

Add a listener to the future result.

public Throwable
cause()

Implements io.vertx.core.Future.cause.

A Throwable describing failure.

public boolean
failed()

Implements io.vertx.core.Future.failed.

Did it fail?

public boolean
isComplete()

Implements io.vertx.core.Future.isComplete.

Has the future completed?

public <U> Future<U>
map(Function<T, U>
the mapper function
mapper
)

Overrides io.vertx.core.impl.future.FutureBase.map, io.vertx.core.impl.future.FutureBase.map.

Implements io.vertx.core.Future.map, io.vertx.core.Future.map.

Apply a mapper function on this future.

public <V> Future<V>
map(V
the value that eventually completes the mapped future
value
)

Overrides io.vertx.core.impl.future.FutureBase.map.

Implements io.vertx.core.Future.map.

Map the result of a future to a specific value.

public Future<T>
onComplete(Handler<AsyncResult<T>>
the handler that will be called with the result
handler
)

Implements io.vertx.core.Future.onComplete.

Add a handler to be notified of the result.

public Future<T>
onFailure(Handler<Throwable>
the handler that will be called with the failed result
handler
)

Overrides default io.vertx.core.Future.onFailure.

Add a handler to be notified of the failed result.

public Future<T>
onSuccess(Handler<T>
the handler that will be called with the succeeded result
handler
)

Overrides default io.vertx.core.Future.onSuccess.

Add a handler to be notified of the succeeded result.

public Future<T>
otherwise(T
the value that eventually completes the mapped future
value
)

Overrides io.vertx.core.impl.future.FutureBase.otherwise.

Implements io.vertx.core.Future.otherwise.

Map the failure of a future to a specific value.

public void
removeListener(Listener<T>
the listener
listener
)

Implements io.vertx.core.impl.future.FutureInternal.removeListener.

Remove a listener to the future result.

public T
result()

Implements io.vertx.core.Future.result.

The result of the operation.

public boolean
succeeded()

Implements io.vertx.core.Future.succeeded.

Did it succeed?

public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.

Inherited from io.vertx.core.impl.future.FutureBase:
composecontextemitFailureemitSuccesseventuallyexpectingotherwisetimeouttransform

Field Detail

causeback to summary
private final Throwable cause

Constructor Detail

FailedFutureback to summary
public FailedFuture(Throwable t)

Create a future that has already failed

Parameters
t:Throwable

the throwable

FailedFutureback to summary
public FailedFuture(ContextInternal context, Throwable t)

Create a future that has already failed

Parameters
t:Throwable

the throwable

FailedFutureback to summary
public FailedFuture(String failureMessage)

Create a future that has already failed

Parameters
failureMessage:String

the failure message

FailedFutureback to summary
public FailedFuture(ContextInternal context, String failureMessage)

Create a future that has already failed

Parameters
failureMessage:String

the failure message

Method Detail

addListenerback to summary
public void addListener(Listener<T> listener)

Implements io.vertx.core.impl.future.FutureInternal.addListener.

Doc from io.vertx.core.impl.future.FutureInternal.addListener.

Add a listener to the future result.

Parameters
listener:Listener<T>

the listener

Annotations
@Override
causeback to summary
public Throwable cause()

Implements io.vertx.core.Future.cause.

Doc from io.vertx.core.Future.cause.

A Throwable describing failure. This will be null if the operation succeeded.

Returns:Throwable

the cause or null if the operation succeeded.

Annotations
@Override
failedback to summary
public boolean failed()

Implements io.vertx.core.Future.failed.

Doc from io.vertx.core.Future.failed.

Did it fail?

Returns:boolean

true if it failed or false otherwise

Annotations
@Override
isCompleteback to summary
public boolean isComplete()

Implements io.vertx.core.Future.isComplete.

Doc from io.vertx.core.Future.isComplete.

Has the future completed?

It's completed if it's either succeeded or failed.

Returns:boolean

true if completed, false if not

Annotations
@Override
mapback to summary
public <U> Future<U> map(Function<T, U> mapper)

Overrides io.vertx.core.impl.future.FutureBase.map, io.vertx.core.impl.future.FutureBase.map.

Implements io.vertx.core.Future.map, io.vertx.core.Future.map.

Doc from io.vertx.core.Future.map.

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.

Parameters
mapper:Function<T, U>

the mapper function

Returns:Future<U>

the mapped future

Annotations
@Override
mapback to summary
public <V> Future<V> map(V value)

Overrides io.vertx.core.impl.future.FutureBase.map.

Implements io.vertx.core.Future.map.

Doc from io.vertx.core.Future.map.

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.

Parameters
value:V

the value that eventually completes the mapped future

Returns:Future<V>

the mapped future

Annotations
@Override
onCompleteback to summary
public Future<T> onComplete(Handler<AsyncResult<T>> handler)

Implements io.vertx.core.Future.onComplete.

Doc from io.vertx.core.Future.onComplete.

Add a handler to be notified of the result.

Warning

this is a terminal operation. If several handlers are registered, there is no guarantee that they will be invoked in order of registration.

Parameters
handler:Handler<AsyncResult<T>>

the handler that will be called with the result

Returns:Future<T>

a reference to this, so it can be used fluently

Annotations
@Override
onFailureback to summary
public Future<T> onFailure(Handler<Throwable> handler)

Overrides default io.vertx.core.Future.onFailure.

Doc from io.vertx.core.Future.onFailure.

Add a handler to be notified of the failed result.

Warning

this is a terminal operation. If several handlers are registered, there is no guarantee that they will be invoked in order of registration.

Parameters
handler:Handler<Throwable>

the handler that will be called with the failed result

Returns:Future<T>

a reference to this, so it can be used fluently

Annotations
@Override
onSuccessback to summary
public Future<T> onSuccess(Handler<T> handler)

Overrides default io.vertx.core.Future.onSuccess.

Doc from io.vertx.core.Future.onSuccess.

Add a handler to be notified of the succeeded result.

Warning

this is a terminal operation. If several handlers are registered, there is no guarantee that they will be invoked in order of registration.

Parameters
handler:Handler<T>

the handler that will be called with the succeeded result

Returns:Future<T>

a reference to this, so it can be used fluently

Annotations
@Override
otherwiseback to summary
public Future<T> otherwise(T value)

Overrides io.vertx.core.impl.future.FutureBase.otherwise.

Implements io.vertx.core.Future.otherwise.

Doc from io.vertx.core.Future.otherwise.

Map the failure of a future to a specific 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.

Parameters
value:T

the value that eventually completes the mapped future

Returns:Future<T>

the mapped future

Annotations
@Override
removeListenerback to summary
public void removeListener(Listener<T> listener)

Implements io.vertx.core.impl.future.FutureInternal.removeListener.

Doc from io.vertx.core.impl.future.FutureInternal.removeListener.

Remove a listener to the future result.

Parameters
listener:Listener<T>

the listener

Annotations
@Override
resultback to summary
public T result()

Implements io.vertx.core.Future.result.

Doc from io.vertx.core.Future.result.

The result of the operation. This will be null if the operation failed.

Returns:T

the result or null if the operation failed.

Annotations
@Override
succeededback to summary
public boolean succeeded()

Implements io.vertx.core.Future.succeeded.

Doc from io.vertx.core.Future.succeeded.

Did it succeed?

Returns:boolean

true if it succeded or false otherwise

Annotations
@Override
toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object. Satisfying this method's contract implies a non-null result must be returned.

Returns:String

a string representation of the object

Annotations
@Override