org.springframework.util.concurrent

## Class ListenableFutureAdapter<T,S>

- java.lang.Object
- - org.springframework.util.concurrent.FutureAdapter<T,S>
  - - org.springframework.util.concurrent.ListenableFutureAdapter<T,S>

- Type Parameters:
    `T` - the type of this `Future`
    `S` - the type of the adaptee's `Future`
  All Implemented Interfaces:
    Future<T>, ListenableFuture<T>

      public abstract class ListenableFutureAdapter<T,S>
      extends FutureAdapter<T,S>
      implements ListenableFuture<T>

  Abstract class that adapts a `ListenableFuture` parameterized over S into a `ListenableFuture` parameterized over T. All methods are delegated to the adaptee, where `FutureAdapter.get()`, `FutureAdapter.get(long, java.util.concurrent.TimeUnit)`, and `ListenableFutureCallback.onSuccess(Object)` call `FutureAdapter.adapt(Object)` on the adaptee's result.
  Since:
    4.0
  Author:
    Arjen Poutsma

- - ### Constructor Summary

    Constructors
    Modifier | Constructor and Description
    --- | ---
    `protected` | `ListenableFutureAdapter(ListenableFuture<S> adaptee)` Constructs a new `ListenableFutureAdapter` with the given adaptee.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `addCallback(ListenableFutureCallback<? super T> callback)` Registers the given callback to this `ListenableFuture`.

    - ### Methods inherited from class org.springframework.util.concurrent.FutureAdapter

      `adapt, cancel, get, get, getAdaptee, isCancelled, isDone`

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

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

    - ### Methods inherited from interface java.util.concurrent.Future

      `cancel, get, get, isCancelled, isDone`

- - ### Constructor Detail

    - #### ListenableFutureAdapter

          protected ListenableFutureAdapter(ListenableFuture<S> adaptee)

      Constructs a new `ListenableFutureAdapter` with the given adaptee.
      Parameters:
        `adaptee` - the future to adaptee to

  - ### Method Detail

    - #### addCallback

          public void addCallback(ListenableFutureCallback<? super T> callback)

      Description copied from interface: `ListenableFuture`
      Registers the given callback to this `ListenableFuture`. The callback will be triggered when this `Future` is complete or, if it is already complete, immediately.
      Specified by:
        `addCallback` in interface `ListenableFuture<T>`
      Parameters:
        `callback` - the callback to register