Class Util
- java.lang.Object
-
- ca.stellardrift.permissionsex.impl.util.Util
-
-
Constructor Summary
Constructors Constructor Description Util()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static <T> CompletableFuture<T>asyncFailableFuture(org.spongepowered.configurate.util.CheckedSupplier<T,?> supplier, Executor exec)static <T> Optional<T>castOptional(Optional<?> input, Class<T> clazz)Given anOptionalof an unknown type, safely cast it to the expected type.static <T> CompletableFuture<T>emptyFuture()static <I,T>
CompletableFuture<T>failableFuture(I value, org.spongepowered.configurate.util.CheckedFunction<I,T,?> func)static <T> CompletableFuture<T>failableFuture(org.spongepowered.configurate.util.CheckedSupplier<T,?> func)static <T> CompletableFuture<T>failedFuture(Throwable error)
-
-
-
Constructor Detail
-
Util
public Util()
-
-
Method Detail
-
castOptional
public static <T> Optional<T> castOptional(Optional<?> input, Class<T> clazz)
Given anOptionalof an unknown type, safely cast it to the expected type. If the optional is not of the required type, an empty optional is returned.- Type Parameters:
T- The type of the class- Parameters:
input- The input valueclazz- The class to cast to- Returns:
- A casted or empty Optional
-
failedFuture
public static <T> CompletableFuture<T> failedFuture(Throwable error)
-
emptyFuture
public static <T> CompletableFuture<T> emptyFuture()
-
failableFuture
public static <I,T> CompletableFuture<T> failableFuture(I value, org.spongepowered.configurate.util.CheckedFunction<I,T,?> func)
-
failableFuture
public static <T> CompletableFuture<T> failableFuture(org.spongepowered.configurate.util.CheckedSupplier<T,?> func)
-
asyncFailableFuture
public static <T> CompletableFuture<T> asyncFailableFuture(org.spongepowered.configurate.util.CheckedSupplier<T,?> supplier, Executor exec)
-
-