Class AbstractTransformFuture<I,O,F,T>

All Implemented Interfaces:
AbstractFuture.Trusted<O>, ListenableFuture<O>, Runnable, Future<O>
Direct Known Subclasses:
AbstractTransformFuture.AsyncTransformFuture, AbstractTransformFuture.TransformFuture

abstract class AbstractTransformFuture<I,O,F,T> extends FluentFuture.TrustedFuture<O> implements Runnable
Implementations of Futures.transform*.
  • Field Details

    • inputFuture

      @CheckForNull ListenableFuture<? extends I> inputFuture
    • function

      @CheckForNull F function
  • Constructor Details

    • AbstractTransformFuture

      AbstractTransformFuture(ListenableFuture<? extends I> inputFuture, F function)
  • Method Details

    • createAsync

      static <I, O> ListenableFuture<O> createAsync(ListenableFuture<I> input, AsyncFunction<? super I,? extends O> function, Executor executor)
    • create

      static <I, O> ListenableFuture<O> create(ListenableFuture<I> input, Function<? super I,? extends O> function, Executor executor)
    • run

      public final void run()
      Specified by:
      run in interface Runnable
    • doTransform

      abstract T doTransform(F function, I result) throws Exception
      Template method for subtypes to actually run the transform.
      Throws:
      Exception
    • setResult

      abstract void setResult(T result)
      Template method for subtypes to actually set the result.
    • afterDone

      protected final void afterDone()
      Description copied from class: AbstractFuture
      Callback method that is called exactly once after the future is completed.

      If AbstractFuture.interruptTask() is also run during completion, AbstractFuture.afterDone() runs after it.

      The default implementation of this method in AbstractFuture does nothing. This is intended for very lightweight cleanup work, for example, timing statistics or clearing fields. If your task does anything heavier consider, just using a listener with an executor.

      Overrides:
      afterDone in class AbstractFuture<O>
    • pendingToString

      @CheckForNull protected String pendingToString()
      Description copied from class: AbstractFuture
      Provide a human-readable explanation of why this future has not yet completed.
      Overrides:
      pendingToString in class AbstractFuture<O>
      Returns:
      null if an explanation cannot be provided (e.g. because the future is done).