@GwtCompatible abstract class AbstractTransformFuture<I,O,F,T> extends AbstractFuture.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>
|
AbstractFuture.TrustedFuture<V>
Modifier and Type | Field and Description |
---|---|
(package private) F |
function |
(package private) ListenableFuture<? extends I> |
inputFuture |
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) |
(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) |
(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.
|
void |
run() |
(package private) abstract void |
setResult(T result)
Template method for subtypes to actually set the result.
|
addListener, cancel, get, get, isCancelled, isDone
interruptTask, maybePropagateCancellation, set, setException, setFuture, trustedGetException, wasInterrupted
@Nullable ListenableFuture<? extends I> inputFuture
@Nullable F function
AbstractTransformFuture(ListenableFuture<? extends I> inputFuture, F function)
static <I,O> ListenableFuture<O> create(ListenableFuture<I> input, AsyncFunction<? super I,? extends O> 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)
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.Runnable
@Nullable abstract T doTransform(F function, @Nullable I result) throws java.lang.Exception
java.lang.Exception
abstract void setResult(@Nullable T result)
protected final void afterDone()
AbstractFuture
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.
afterDone
in class AbstractFuture<O>