Package dev.satyrn.papermc.api.util.v2
Class Cast
java.lang.Object
dev.satyrn.papermc.api.util.v2.Cast
Deprecated, for removal: This API element is subject to removal in a future version.
Utility for safe-casting between objects.
- Since:
- 1.6.0
- Author:
- Isabel Maskrey
-
Method Summary
-
Method Details
-
as
@NotNull public static <T> @NotNull Optional<T> as(@NotNull @NotNull Class<T> asClass, @Nullable @Nullable Object object) Deprecated, for removal: This API element is subject to removal in a future version.Safe-casts an object to another type.- Type Parameters:
T
- The type that the object will be cast to.- Parameters:
asClass
- The class to cast to.object
- The object to cast.- Returns:
- An optional of T where the result is only present if the cast succeeded.
-
Cast
instead.