public class FutureUtils extends Object
| Modifier and Type | Class and Description |
|---|---|
static class |
FutureUtils.CompletionBuilder<T> |
| Constructor and Description |
|---|
FutureUtils() |
| Modifier and Type | Method and Description |
|---|---|
static <T> FutureUtils.CompletionBuilder<T> |
complete(CompletableFuture<T> future)
Complete
future with the result of the CompletableFuture that is provided to the returned
FutureUtils.CompletionBuilder. |
static <T> FutureUtils.CompletionBuilder<T> |
completeAsync(CompletableFuture<T> future,
Executor executor)
Complete
future asynchronously with the result of the CompletableFuture that is provided to
the returned FutureUtils.CompletionBuilder. |
static <T> CompletableFuture<T> |
failedFuture(Throwable ex)
Return a
CompletableFuture that has been completed exceptionally using the provided Throwable. |
static <T> CompletableFuture<T> |
failedUaFuture(long statusCode)
Return a
CompletableFuture that has been completed exceptionally with a UaException built from
statusCode. |
static <T> CompletableFuture<T> |
failedUaFuture(StatusCode statusCode)
Return a
CompletableFuture that has been completed exceptionally with a UaException built from
statusCode. |
static <T> CompletableFuture<T> |
failedUaFuture(Throwable cause,
long statusCode)
Return a
CompletableFuture that has been completed exceptionally with a UaException built from
statusCode. |
static <T> CompletableFuture<List<T>> |
flatSequence(List<CompletableFuture<List<T>>> futures)
Flatten a List of future Lists into a CompletableFuture of List
|
static <T> CompletableFuture<List<T>> |
sequence(CompletableFuture<T>... futures) |
static <T> CompletableFuture<List<T>> |
sequence(List<CompletableFuture<T>> futures) |
static <T> CompletableFuture<List<T>> |
sequence(Stream<CompletableFuture<T>> stream) |
static <T> CompletableFuture<T> |
unwrap(CompletableFuture<CompletableFuture<T>> future)
Unwrap a CompletableFuture of CompletableFuture of
T into a CompletableFuture of T. |
public static <T> CompletableFuture<List<T>> sequence(Stream<CompletableFuture<T>> stream)
public static <T> CompletableFuture<List<T>> sequence(List<CompletableFuture<T>> futures)
public static <T> CompletableFuture<List<T>> sequence(CompletableFuture<T>... futures)
public static <T> CompletableFuture<T> failedFuture(Throwable ex)
CompletableFuture that has been completed exceptionally using the provided Throwable.ex - the Throwable to complete with.CompletableFuture that has been completed exceptionally using the provided Throwable.public static <T> CompletableFuture<T> failedUaFuture(long statusCode)
CompletableFuture that has been completed exceptionally with a UaException built from
statusCode.statusCode - the status code to build the UaException with.CompletableFuture that has been completed exceptionally with a UaException built from
statusCode.public static <T> CompletableFuture<T> failedUaFuture(StatusCode statusCode)
CompletableFuture that has been completed exceptionally with a UaException built from
statusCode.statusCode - the StatusCode to build the UaException with.CompletableFuture that has been completed exceptionally with a UaException built from
statusCode.public static <T> CompletableFuture<T> failedUaFuture(Throwable cause, long statusCode)
CompletableFuture that has been completed exceptionally with a UaException built from
statusCode.cause - the inner Exception.statusCode - the status code to build the UaException with.CompletableFuture that has been completed exceptionally with a UaException built from
statusCode.public static <T> FutureUtils.CompletionBuilder<T> complete(CompletableFuture<T> future)
future with the result of the CompletableFuture that is provided to the returned
FutureUtils.CompletionBuilder.future - the future to complete.FutureUtils.CompletionBuilder.public static <T> FutureUtils.CompletionBuilder<T> completeAsync(CompletableFuture<T> future, Executor executor)
future asynchronously with the result of the CompletableFuture that is provided to
the returned FutureUtils.CompletionBuilder.future - the future to complete.executor - the Executor to use.FutureUtils.CompletionBuilder.public static <T> CompletableFuture<List<T>> flatSequence(List<CompletableFuture<List<T>>> futures)
T - the type of item the List holdsfutures - a List of future Listspublic static <T> CompletableFuture<T> unwrap(CompletableFuture<CompletableFuture<T>> future)
T into a CompletableFuture of T.future - a CompletableFuture of CompletableFuture of T.T.Copyright © 2025. All rights reserved.