Package graphql.execution
Class Async
- java.lang.Object
-
- graphql.execution.Async
-
public class Async extends java.lang.Object
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interface
Async.CFFactory<T,U>
static interface
Async.CombinedBuilder<T>
-
Constructor Summary
Constructors Constructor Description Async()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static <T,U>
java.util.concurrent.CompletableFuture<java.util.List<U>>each(java.util.Collection<T> list, java.util.function.BiFunction<T,java.lang.Integer,java.util.concurrent.CompletableFuture<U>> cfFactory)
static <T,U>
java.util.concurrent.CompletableFuture<java.util.List<U>>eachSequentially(java.lang.Iterable<T> list, Async.CFFactory<T,U> cfFactory)
static <T> java.util.concurrent.CompletableFuture<T>
exceptionallyCompletedFuture(java.lang.Throwable exception)
static <T> Async.CombinedBuilder<T>
ofExpectedSize(int expectedSize)
Combines 0 or more CF into one.static <T> java.util.concurrent.CompletableFuture<T>
toCompletableFuture(T t)
Turns an object T into a CompletableFuture if it's not alreadystatic <T> java.util.concurrent.CompletableFuture<T>
tryCatch(java.util.function.Supplier<java.util.concurrent.CompletableFuture<T>> supplier)
-
-
-
Method Detail
-
ofExpectedSize
public static <T> Async.CombinedBuilder<T> ofExpectedSize(int expectedSize)
Combines 0 or more CF into one. It is a wrapper aroundCompletableFuture.allOf
.- Type Parameters:
T
- for two- Parameters:
expectedSize
- how many we expect- Returns:
- a combined builder of CFs
-
each
public static <T,U> java.util.concurrent.CompletableFuture<java.util.List<U>> each(java.util.Collection<T> list, java.util.function.BiFunction<T,java.lang.Integer,java.util.concurrent.CompletableFuture<U>> cfFactory)
-
eachSequentially
public static <T,U> java.util.concurrent.CompletableFuture<java.util.List<U>> eachSequentially(java.lang.Iterable<T> list, Async.CFFactory<T,U> cfFactory)
-
toCompletableFuture
public static <T> java.util.concurrent.CompletableFuture<T> toCompletableFuture(T t)
Turns an object T into a CompletableFuture if it's not already- Type Parameters:
T
- for two- Parameters:
t
- - the object to check- Returns:
- a CompletableFuture
-
tryCatch
public static <T> java.util.concurrent.CompletableFuture<T> tryCatch(java.util.function.Supplier<java.util.concurrent.CompletableFuture<T>> supplier)
-
exceptionallyCompletedFuture
public static <T> java.util.concurrent.CompletableFuture<T> exceptionallyCompletedFuture(java.lang.Throwable exception)
-
-