Class AbstractTransformFuture<I,O,F,T>
- java.lang.Object
-
- com.google.common.util.concurrent.internal.InternalFutureFailureAccess
-
- com.google.common.util.concurrent.AbstractFuture<V>
-
- com.google.common.util.concurrent.GwtFluentFutureCatchingSpecialization<V>
-
- com.google.common.util.concurrent.FluentFuture<V>
-
- 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>,java.lang.Runnable,java.util.concurrent.Future<O>
- Direct Known Subclasses:
AbstractTransformFuture.AsyncTransformFuture,AbstractTransformFuture.TransformFuture
@GwtCompatible abstract class AbstractTransformFuture<I,O,F,T> extends FluentFuture.TrustedFuture<O> implements java.lang.Runnable
Implementations ofFutures.transform*.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private static classAbstractTransformFuture.AsyncTransformFuture<I,O>AnAbstractTransformFuturethat delegates to anAsyncFunctionandAbstractFuture.setFuture(ListenableFuture).private static classAbstractTransformFuture.TransformFuture<I,O>-
Nested 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>
-
-
Field Summary
Fields Modifier and Type Field Description (package private) Ffunction(package private) ListenableFuture<? extends I>inputFuture
-
Constructor Summary
Constructors Constructor Description AbstractTransformFuture(ListenableFuture<? extends I> inputFuture, F function)
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected voidafterDone()Callback 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, java.util.concurrent.Executor executor)(package private) static <I,O>
ListenableFuture<O>create(ListenableFuture<I> input, AsyncFunction<? super I,? extends O> function, java.util.concurrent.Executor executor)(package private) abstract TdoTransform(F function, I result)Template method for subtypes to actually run the transform.protected java.lang.StringpendingToString()Provide a human-readable explanation of why this future has not yet completed.voidrun()(package private) abstract voidsetResult(T result)Template method for subtypes to actually set the result.-
Methods inherited from class com.google.common.util.concurrent.FluentFuture.TrustedFuture
addListener, cancel, get, get, isCancelled, isDone
-
Methods inherited from class com.google.common.util.concurrent.FluentFuture
addCallback, catching, catchingAsync, from, from, transform, transformAsync, withTimeout, withTimeout
-
Methods inherited from class com.google.common.util.concurrent.AbstractFuture
interruptTask, maybePropagateCancellationTo, set, setException, setFuture, toString, tryInternalFastPathGetFailure, wasInterrupted
-
-
-
-
Field Detail
-
inputFuture
ListenableFuture<? extends I> inputFuture
-
function
F function
-
-
Constructor Detail
-
AbstractTransformFuture
AbstractTransformFuture(ListenableFuture<? extends I> inputFuture, F function)
-
-
Method Detail
-
create
static <I,O> ListenableFuture<O> create(ListenableFuture<I> input, AsyncFunction<? super I,? extends O> function, java.util.concurrent.Executor executor)
-
create
static <I,O> ListenableFuture<O> create(ListenableFuture<I> input, Function<? super I,? extends O> function, java.util.concurrent.Executor executor)
-
run
public final void run()
- Specified by:
runin interfacejava.lang.Runnable
-
doTransform
abstract T doTransform(F function, I result) throws java.lang.Exception
Template method for subtypes to actually run the transform.- Throws:
java.lang.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: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
protected java.lang.String 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 because the future is done.
-
-