Enum Class CompletableFutures
- All Implemented Interfaces:
Serializable, Comparable<CompletableFutures>, Constable
Utility class with
CompletableFuture and CompletionStage useful methods.- Since:
- 5.2
- Author:
- Pedro Ruivo
-
Nested Class Summary
Nested classes/interfaces inherited from class Enum
Enum.EnumDesc<E> -
Enum Constant Summary
Enum Constants -
Method Summary
Modifier and TypeMethodDescriptionstatic CompletableFuture<Boolean> static <T> CompletableFuture<T> AnullcompletedCompletableFuture.static CompletableFuture<Boolean> static <T> Tjoin(CompletableFuture<T> cf) Waits for theCompletableFutureto complete.static <T> Tjoin(CompletionStage<T> cs) Same asjoin(CompletableFuture)but it receives aCompletionStageas parameter.static CompletableFuturesReturns the enum constant of this class with the specified name.static CompletableFutures[]values()Returns an array containing the constants of this enum class, in the order they are declared.static <T> Consumer<T> Consumes any value and return aVoid.static CompletionExceptionwrapAsCompletionException(Throwable throwable) Wraps thethrowableintoCompletionException.
-
Enum Constant Details
-
INSTANCE
-
-
Method Details
-
values
Returns an array containing the constants of this enum class, in the order they are declared.- Returns:
- an array containing the constants of this enum class, in the order they are declared
-
valueOf
Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)- Parameters:
name- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
IllegalArgumentException- if this enum class has no constant with the specified nameNullPointerException- if the argument is null
-
join
Same asjoin(CompletableFuture)but it receives aCompletionStageas parameter.- See Also:
-
join
Waits for theCompletableFutureto complete.Any non
RuntimeExceptionthrown is converted to aRuntimeException.- Type Parameters:
T- The value type.- Parameters:
cf- TheCompletableFuture- Returns:
- The value of the completed
CompletableFuture.
-
completedNull
AnullcompletedCompletableFuture.- Type Parameters:
T- The value type.- Returns:
- The
CompletableFuture.
-
voidConsumer
-
wrapAsCompletionException
Wraps thethrowableintoCompletionException.- Parameters:
throwable- TheThrowableto wrap.- Returns:
- The
CompletionExceptionwiththrowable.
-
toVoidFunction
-
completedTrue
- Returns:
- A
CompletableFuturecompleted with valueBoolean.TRUE
-
completedFalse
- Returns:
- A
CompletableFuturecompleted with valueBoolean.FALSE
-