Class AbstractTransformFuture<I,O,F,T>
java.lang.Object
com.google.common.util.concurrent.internal.InternalFutureFailureAccess
com.google.common.util.concurrent.AbstractFuture<O>
com.google.common.util.concurrent.GwtFluentFutureCatchingSpecialization<O>
com.google.common.util.concurrent.FluentFuture<O>
com.google.common.util.concurrent.FluentFuture.TrustedFuture<O>
com.google.common.util.concurrent.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*.-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate static final classAnAbstractTransformFuturethat delegates to anAsyncFunctionandAbstractFuture.setFuture(ListenableFuture).private static final classNested classes/interfaces inherited from class com.google.common.util.concurrent.FluentFuture
FluentFuture.TrustedFuture<V>Nested classes/interfaces inherited from class com.google.common.util.concurrent.AbstractFuture
AbstractFuture.Trusted<V>Nested classes/interfaces inherited from interface java.util.concurrent.Future
Future.State -
Field Summary
FieldsModifier and TypeFieldDescription(package private) F(package private) ListenableFuture<? extends I> Fields inherited from class com.google.common.util.concurrent.AbstractFuture
GENERATE_CANCELLATION_CAUSES, log -
Constructor Summary
ConstructorsConstructorDescriptionAbstractTransformFuture(ListenableFuture<? extends I> inputFuture, F function) -
Method Summary
Modifier and TypeMethodDescriptionprotected final voidCallback method that is called exactly once after the future is completed.(package private) static <I,O> ListenableFuture <O> create(ListenableFuture<I> input, Function<? super I, ? extends O> function, Executor executor) (package private) static <I,O> ListenableFuture <O> createAsync(ListenableFuture<I> input, AsyncFunction<? super I, ? extends O> function, Executor executor) (package private) abstract TdoTransform(F function, I result) Template method for subtypes to actually run the transform.protected StringProvide a human-readable explanation of why this future has not yet completed.final voidrun()(package private) abstract voidTemplate method for subtypes to actually set the result.Methods inherited from class com.google.common.util.concurrent.FluentFuture.TrustedFuture
addListener, cancel, get, get, isCancelled, isDoneMethods inherited from class com.google.common.util.concurrent.FluentFuture
addCallback, catching, catchingAsync, from, from, transform, transformAsync, withTimeout, withTimeoutMethods inherited from class com.google.common.util.concurrent.AbstractFuture
interruptTask, maybePropagateCancellationTo, set, setException, setFuture, toString, tryInternalFastPathGetFailure, wasInterruptedMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface java.util.concurrent.Future
exceptionNow, resultNow, state
-
Field Details
-
inputFuture
-
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() -
doTransform
Template method for subtypes to actually run the transform.- Throws:
Exception
-
setResult
Template method for subtypes to actually set the result. -
afterDone
protected final void afterDone()Description copied from class:AbstractFutureCallback 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
AbstractFuturedoes 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:
afterDonein classAbstractFuture<O>
-
pendingToString
Description copied from class:AbstractFutureProvide a human-readable explanation of why this future has not yet completed.- Overrides:
pendingToStringin classAbstractFuture<O>- Returns:
- null if an explanation cannot be provided (e.g. because the future is done).
-