Package org.jgroups.util
Enum CompletableFutures
- All Implemented Interfaces:
Serializable,Comparable<CompletableFutures>,java.lang.constant.Constable
Utility class with
CompletableFuture and CompletionStage useful methods.- Since:
- 5.2
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>> -
Enum Constant Summary
Enum Constants -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final CompletableFuture<Boolean> private static final CompletableFuture<?> private static final Function<?, ?> private static final CompletableFuture<Boolean> private static final Consumer<?> -
Constructor Summary
Constructors -
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 type with the specified name.static CompletableFutures[]values()Returns an array containing the constants of this enum type, 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
-
-
Field Details
-
NULL
-
TRUE_CF
-
FALSE_CF
-
VOID_CONSUMER
-
NULL_FUNCTION
-
-
Constructor Details
-
CompletableFutures
private CompletableFutures()
-
-
Method Details
-
values
Returns an array containing the constants of this enum type, in the order they are declared.- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
valueOf
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (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 type 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
Consumes any value and return aVoid.- Type Parameters:
T- The value type.- Returns:
- The
Consumer.
-
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
-