io.vertx.reactivex.core

## Class Future<T>

- java.lang.Object
- - io.vertx.reactivex.core.Future<T>

- Direct Known Subclasses:
    CompositeFuture, HttpClientRequest

      public class Future<T>
      extends Object

  Represents the result of an action that may, or may not, have occurred yet.

  NOTE: This class has been automatically generated from the `original` non RX-ified interface using Vert.x codegen.

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static io.vertx.lang.rx.TypeArg<Future>` | `__TYPE_ARG`
    `io.vertx.lang.rx.TypeArg<T>` | `__typeArg_0`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `Future(Future delegate)`
    `Future(Object delegate, io.vertx.lang.rx.TypeArg<T> typeArg_0)`

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `Throwable` | `cause()` A Throwable describing failure.
    `<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.
    `<U> Future<U>` | `compose(Function<T,Single<U>> mapper)` Compose this future with a `mapper` function.
    `<U> Future<U>` | `compose(Function<T,Single<U>> successMapper, Function<Throwable,Single<U>> failureMapper)` Compose this future with a `successMapper` and `failureMapper` functions.
    `boolean` | `equals(Object o)`
    `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)` Alias for `compose(java.util.function.Function<T, io.vertx.reactivex.core.Future<U>>)`.
    `<U> Future<U>` | `flatMap(Function<T,Single<U>> mapper)` Alias for `compose(java.util.function.Function<T, io.vertx.reactivex.core.Future<U>>)`.
    `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()` Add a handler to be notified of the result.
    `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.
    `Future<T>` | `recover(Function<Throwable,Single<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.
    `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()`

    - ### Methods inherited from class java.lang.Object

      `clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

- - ### Field Detail

    - #### __TYPE_ARG

          public static final io.vertx.lang.rx.TypeArg<Future> __TYPE_ARG

    - #### __typeArg_0

          public final io.vertx.lang.rx.TypeArg<T> __typeArg_0

  - ### Constructor Detail

    - #### Future

          public Future(Future delegate)

    - #### Future

          public Future(Object delegate,
                        io.vertx.lang.rx.TypeArg<T> typeArg_0)

  - ### Method Detail

    - #### toString

          public String toString()

      Overrides:
        `toString` in class `Object`

    - #### equals

          public boolean equals(Object o)

      Overrides:
        `equals` in class `Object`

    - #### hashCode

          public int hashCode()

      Overrides:
        `hashCode` in class `Object`

    - #### getDelegate

          public Future getDelegate()

    - #### future

          public 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.
      Parameters:
        `handler` - the handler
      Returns:
        the future.

    - #### succeededFuture

          public static <T> Future<T> succeededFuture()

      Create a succeeded future with a null result
      Returns:
        the future

    - #### succeededFuture

          public static <T> Future<T> succeededFuture(T result)

      Created a succeeded future with the specified result.
      Parameters:
        `result` - the result
      Returns:
        the future

    - #### failedFuture

          public static <T> Future<T> failedFuture(Throwable t)

      Create a failed future with the specified failure cause.
      Parameters:
        `t` - the failure cause as a Throwable
      Returns:
        the future

    - #### failedFuture

          public static <T> Future<T> failedFuture(String failureMessage)

      Create a failed future with the specified failure message.
      Parameters:
        `failureMessage` - the failure message
      Returns:
        the future

    - #### isComplete

          public boolean isComplete()

      Has the future completed?

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

      Returns:
        true if completed, false if not

    - #### onComplete

          public Future<T> onComplete(Handler<AsyncResult<T>> handler)

      Add a handler to be notified of the result.
      Parameters:
        `handler` - the handler that will be called with the result
      Returns:
        a reference to this, so it can be used fluently

    - #### onComplete

          public Future<T> onComplete()

      Add a handler to be notified of the result.
      Returns:
        a reference to this, so it can be used fluently

    - #### rxOnComplete

          public Single<T> rxOnComplete()

      Add a handler to be notified of the result.
      Returns:
        a reference to this, so it can be used fluently

    - #### onSuccess

          public Future<T> onSuccess(Handler<T> handler)

      Add a handler to be notified of the succeeded result.
      Parameters:
        `handler` - the handler that will be called with the succeeded result
      Returns:
        a reference to this, so it can be used fluently

    - #### onFailure

          public Future<T> onFailure(Handler<Throwable> handler)

      Add a handler to be notified of the failed result.
      Parameters:
        `handler` - the handler that will be called with the failed result
      Returns:
        a reference to this, so it can be used fluently

    - #### result

          public T result()

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

    - #### cause

          public Throwable cause()

      A Throwable describing failure. This will be null if the operation succeeded.
      Returns:
        the cause or null if the operation succeeded.

    - #### succeeded

          public boolean succeeded()

      Did it succeed?
      Returns:
        true if it succeded or false otherwise

    - #### failed

          public boolean failed()

      Did it fail?
      Returns:
        true if it failed or false otherwise

    - #### flatMap

          public <U> Future<U> flatMap(java.util.function.Function<T,Future<U>> mapper)

      Alias for `compose(java.util.function.Function<T, io.vertx.reactivex.core.Future<U>>)`.
      Parameters:
        `mapper` -
      Returns:

    - #### flatMap

          public <U> Future<U> flatMap(Function<T,Single<U>> mapper)

      Alias for `compose(java.util.function.Function<T, io.vertx.reactivex.core.Future<U>>)`.
      Parameters:
        `mapper` -
      Returns:

    - #### compose

          public <U> Future<U> compose(java.util.function.Function<T,Future<U>> mapper)

      Compose this future with a `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.

      Parameters:
        `mapper` - the mapper function
      Returns:
        the composed future

    - #### compose

          public <U> Future<U> compose(Function<T,Single<U>> mapper)

      Compose this future with a `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.

      Parameters:
        `mapper` - the mapper function
      Returns:
        the composed future

    - #### recover

          public Future<T> recover(java.util.function.Function<Throwable,Future<T>> mapper)

      Handles a failure of this Future by returning the result of another Future. If the mapper fails, then the returned future will be failed with this failure.
      Parameters:
        `mapper` - A function which takes the exception of a failure and returns a new future.
      Returns:
        A recovered future

    - #### recover

          public Future<T> recover(Function<Throwable,Single<T>> mapper)

      Handles a failure of this Future by returning the result of another Future. If the mapper fails, then the returned future will be failed with this failure.
      Parameters:
        `mapper` - A function which takes the exception of a failure and returns a new future.
      Returns:
        A recovered future

    - #### compose

          public <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.

      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.

      Parameters:
        `successMapper` - the function mapping the success
        `failureMapper` - the function mapping the failure
      Returns:
        the composed future

    - #### compose

          public <U> Future<U> compose(Function<T,Single<U>> successMapper,
                                       Function<Throwable,Single<U>> failureMapper)

      Compose this future with a `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.

      Parameters:
        `successMapper` - the function mapping the success
        `failureMapper` - the function mapping the failure
      Returns:
        the composed future

    - #### map

          public <U> Future<U> map(java.util.function.Function<T,U> mapper)

      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` - the mapper function
      Returns:
        the mapped future

    - #### map

          public <V> Future<V> map(V value)

      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` - the value that eventually completes the mapped future
      Returns:
        the mapped future

    - #### mapEmpty

          public <V> Future<V> mapEmpty()

      Map the result of a future to `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.

      Returns:
        the mapped future

    - #### otherwise

          public Future<T> otherwise(java.util.function.Function<Throwable,T> mapper)

      Apply a `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.

      Parameters:
        `mapper` - the mapper function
      Returns:
        the mapped future

    - #### otherwise

          public Future<T> otherwise(T value)

      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` - the value that eventually completes the mapped future
      Returns:
        the mapped future

    - #### otherwiseEmpty

          public Future<T> otherwiseEmpty()

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

      Returns:
        the mapped future

    - #### newInstance

          public static <T> Future<T> newInstance(Future arg)

    - #### newInstance

          public static <T> Future<T> newInstance(Future arg,
                                                  io.vertx.lang.rx.TypeArg<T> __typeArg_T)

Copyright © 2020 Eclipse. All rights reserved.