Class Cast


  • public final class Cast
    extends Object
    Class to cast an Object to another Object
    • Method Detail

      • cast

        public static <T> T cast​(Object object)
        Method to cast an Object to another Object
        Type Parameters:
        T - the return type
        Parameters:
        object - object
        Returns:
        the return value
      • cast

        public static <T> T cast​(Object object,
                                 Supplier<RuntimeException> runtimeExceptionSupplier)
        Method to cast an Object to another Object, throwing an Exception provided by the Supplier if there is a ClassCastException
        Type Parameters:
        T - the return type
        Parameters:
        object - object
        runtimeExceptionSupplier - runtimeExceptionSupplier
        Returns:
        the return value