io.vertx.rxjava.core

## Class Future<T>

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

- Direct Known Subclasses:
    BridgeEvent, CompositeFuture

      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.

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `Future(Future delegate)`

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    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>` | `future()` Create a future that hasn't completed yet
    `Object` | `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)`
    `T` | `result()` The result of the operation.
    `Future<T>` | `setHandler(Handler<AsyncResult<T>> handler)` Set a handler for the result.
    `Observable<T>` | `setHandlerObservable()` Set a handler for 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.

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

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### Future

          public Future(Future delegate)

  - ### Method Detail

    - #### getDelegate

          public Object getDelegate()

    - #### future

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

      Create a future that hasn't completed yet
      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(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

    - #### setHandler

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

      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.

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

    - #### setHandlerObservable

          public Observable<T> setHandlerObservable()

      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.

      Returns:

    - #### complete

          public void complete(T result)

      Set the result. Any handler will be called, if there is one, and the future will be marked as completed.
      Parameters:
        `result` - the result

    - #### complete

          public void complete()

      Set a null result. Any handler will be called, if there is one, and the future will be marked as completed.

    - #### fail

          public void fail(Throwable throwable)

      Set the failure. Any handler will be called, if there is one, and the future will be marked as completed.
      Parameters:
        `throwable` - the failure cause

    - #### fail

          public void fail(String failureMessage)

      Set the failure. Any handler will be called, if there is one, and the future will be marked as completed.
      Parameters:
        `failureMessage` - the failure message

    - #### 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

    - #### compose

          public <U> Future<U> compose(Handler<T> handler,
                                       Future<U> next)

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

      Parameters:
        `handler` - the handler
        `next` - the next future
      Returns:
        the next future, used for chaining

    - #### 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

    - #### 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

    - #### completer

          public Handler<AsyncResult<T>> completer()

      Returns:
        an handler completing this future

    - #### newInstance

          public static <T> Future newInstance(Future arg)

Copyright © 2016. All rights reserved.