abstract class AbstractTransformFuture<I,O,F,T> extends FluentFuture.TrustedFuture<O> implements java.lang.Runnable
Futures.transform*.| Modifier and Type | Class and Description |
|---|---|
private static class |
AbstractTransformFuture.AsyncTransformFuture<I,O>
An
AbstractTransformFuture that delegates to an AsyncFunction and AbstractFuture.setFuture(ListenableFuture). |
private static class |
AbstractTransformFuture.TransformFuture<I,O>
|
FluentFuture.TrustedFuture<V>AbstractFuture.Trusted<V>| Modifier and Type | Field and Description |
|---|---|
(package private) F |
function |
(package private) ListenableFuture<? extends I> |
inputFuture |
GENERATE_CANCELLATION_CAUSES| Constructor and Description |
|---|
AbstractTransformFuture(ListenableFuture<? extends I> inputFuture,
F function) |
| Modifier and Type | Method and Description |
|---|---|
protected void |
afterDone()
Callback method that is called exactly once after the future is completed.
|
(package private) static <I,O> ListenableFuture<O> |
create(ListenableFuture<I> input,
AsyncFunction<? super I,? extends O> function,
java.util.concurrent.Executor executor) |
(package private) static <I,O> ListenableFuture<O> |
create(ListenableFuture<I> input,
Function<? super I,? extends O> function,
java.util.concurrent.Executor executor) |
(package private) abstract T |
doTransform(F function,
I result)
Template method for subtypes to actually run the transform.
|
protected java.lang.String |
pendingToString()
Provide a human-readable explanation of why this future has not yet completed.
|
void |
run() |
(package private) abstract void |
setResult(T result)
Template method for subtypes to actually set the result.
|
addListener, cancel, get, get, isCancelled, isDoneaddCallback, catching, catchingAsync, from, from, transform, transformAsync, withTimeout, withTimeoutinterruptTask, maybePropagateCancellationTo, set, setException, setFuture, toString, tryInternalFastPathGetFailure, wasInterrupted@CheckForNull ListenableFuture<? extends I> inputFuture
@CheckForNull F function
AbstractTransformFuture(ListenableFuture<? extends I> inputFuture, F function)
static <I,O> ListenableFuture<O> create(ListenableFuture<I> input, AsyncFunction<? super I,? extends O> function, java.util.concurrent.Executor executor)
static <I,O> ListenableFuture<O> create(ListenableFuture<I> input, Function<? super I,? extends O> function, java.util.concurrent.Executor executor)
public final void run()
run in interface java.lang.Runnableabstract T doTransform(F function, I result) throws java.lang.Exception
java.lang.Exceptionabstract void setResult(T result)
protected final void afterDone()
AbstractFutureIf 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.
afterDone in class AbstractFuture<O>@CheckForNull protected java.lang.String pendingToString()
AbstractFuturependingToString in class AbstractFuture<O>