Class ApiFutures (2.3.1)

public final class ApiFutures

Static utility methods for the ApiFuture interface.

Inheritance

java.lang.Object > ApiFutures

Static Methods

<I,O>transformAsync(ApiFuture<I> input, ApiAsyncFunction<I,O> function)

public static ApiFuture<O> <I,O>transformAsync(ApiFuture<I> input, ApiAsyncFunction<I,O> function)
Parameters
NameDescription
inputApiFuture<I>
functionApiAsyncFunction<I,O>
Returns
TypeDescription
ApiFuture<O>

<I,O>transformAsync(ApiFuture<I> input, ApiAsyncFunction<I,O> function, Executor executor)

public static ApiFuture<O> <I,O>transformAsync(ApiFuture<I> input, ApiAsyncFunction<I,O> function, Executor executor)
Parameters
NameDescription
inputApiFuture<I>
functionApiAsyncFunction<I,O>
executorExecutor
Returns
TypeDescription
ApiFuture<O>

<V,X>catching(ApiFuture<? extends V> input, Class<X> exceptionType, ApiFunction<? super X,? extends V> callback)

public static ApiFuture<V> <V,X>catching(ApiFuture<? extends V> input, Class<X> exceptionType, ApiFunction<? super X,? extends V> callback)
Parameters
NameDescription
inputApiFuture<? extends V>
exceptionTypeClass<X>
callbackApiFunction<? super X,? extends V>
Returns
TypeDescription
ApiFuture<V>

<V,X>catching(ApiFuture<? extends V> input, Class<X> exceptionType, ApiFunction<? super X,? extends V> callback, Executor executor)

public static ApiFuture<V> <V,X>catching(ApiFuture<? extends V> input, Class<X> exceptionType, ApiFunction<? super X,? extends V> callback, Executor executor)
Parameters
NameDescription
inputApiFuture<? extends V>
exceptionTypeClass<X>
callbackApiFunction<? super X,? extends V>
executorExecutor
Returns
TypeDescription
ApiFuture<V>

<V,X>catchingAsync(ApiFuture<V> input, Class<X> exceptionType, ApiAsyncFunction<? super X,V> callback, Executor executor)

public static ApiFuture<V> <V,X>catchingAsync(ApiFuture<V> input, Class<X> exceptionType, ApiAsyncFunction<? super X,V> callback, Executor executor)
Parameters
NameDescription
inputApiFuture<V>
exceptionTypeClass<X>
callbackApiAsyncFunction<? super X,V>
executorExecutor
Returns
TypeDescription
ApiFuture<V>

<V,X>transform(ApiFuture<? extends V> input, ApiFunction<? super V,? extends X> function)

public static ApiFuture<X> <V,X>transform(ApiFuture<? extends V> input, ApiFunction<? super V,? extends X> function)
Parameters
NameDescription
inputApiFuture<? extends V>
functionApiFunction<? super V,? extends X>
Returns
TypeDescription
ApiFuture<X>

<V,X>transform(ApiFuture<? extends V> input, ApiFunction<? super V,? extends X> function, Executor executor)

public static ApiFuture<X> <V,X>transform(ApiFuture<? extends V> input, ApiFunction<? super V,? extends X> function, Executor executor)
Parameters
NameDescription
inputApiFuture<? extends V>
functionApiFunction<? super V,? extends X>
executorExecutor
Returns
TypeDescription
ApiFuture<X>

<V>addCallback(ApiFuture<V> future, ApiFutureCallback<? super V> callback)

public static void <V>addCallback(ApiFuture<V> future, ApiFutureCallback<? super V> callback)
Parameters
NameDescription
futureApiFuture<V>
callbackApiFutureCallback<? super V>

<V>addCallback(ApiFuture<V> future, ApiFutureCallback<? super V> callback, Executor executor)

public static void <V>addCallback(ApiFuture<V> future, ApiFutureCallback<? super V> callback, Executor executor)
Parameters
NameDescription
futureApiFuture<V>
callbackApiFutureCallback<? super V>
executorExecutor

<V>allAsList(Iterable<? extends ApiFuture<? extends V>> futures)

public static ApiFuture<List<V>> <V>allAsList(Iterable<? extends ApiFuture<? extends V>> futures)
Parameter
NameDescription
futuresIterable<? extends com.google.api.core.ApiFuture<? extends V>>
Returns
TypeDescription
ApiFuture<List<V>>

<V>immediateCancelledFuture()

public static ApiFuture<V> <V>immediateCancelledFuture()
Returns
TypeDescription
ApiFuture<V>

<V>immediateFailedFuture(Throwable throwable)

public static ApiFuture<V> <V>immediateFailedFuture(Throwable throwable)
Parameter
NameDescription
throwableThrowable
Returns
TypeDescription
ApiFuture<V>

<V>immediateFuture(V value)

public static ApiFuture<V> <V>immediateFuture(V value)
Parameter
NameDescription
valueV
Returns
TypeDescription
ApiFuture<V>

<V>successfulAsList(Iterable<? extends ApiFuture<? extends V>> futures)

public static ApiFuture<List<V>> <V>successfulAsList(Iterable<? extends ApiFuture<? extends V>> futures)
Parameter
NameDescription
futuresIterable<? extends com.google.api.core.ApiFuture<? extends V>>
Returns
TypeDescription
ApiFuture<List<V>>