Class ExceptionUtil


  • public class ExceptionUtil
    extends java.lang.Object
    • Method Detail

      • castAndThrow

        public static <E extends java.lang.Exception> void castAndThrow​(java.lang.Throwable exception,
                                                                        java.lang.Class<E> exceptionClass)
                                                                 throws E extends java.lang.Exception
        Throws:
        E extends java.lang.Exception
      • runSafely

        public static <R,​E1 extends java.lang.Exception> R runSafely​(ExceptionUtil.Block<R,​E1,​java.lang.RuntimeException,​java.lang.RuntimeException> block,
                                                                           ExceptionUtil.CatchBlock catchBlock,
                                                                           ExceptionUtil.FinallyBlock finallyBlock,
                                                                           java.lang.Class<? extends E1> e1Class)
                                                                    throws E1 extends java.lang.Exception
        Throws:
        E1 extends java.lang.Exception
      • runSafely

        public static <R,​E1 extends java.lang.Exception,​E2 extends java.lang.Exception> R runSafely​(ExceptionUtil.Block<R,​E1,​E2,​java.lang.RuntimeException> block,
                                                                                                                ExceptionUtil.CatchBlock catchBlock,
                                                                                                                ExceptionUtil.FinallyBlock finallyBlock,
                                                                                                                java.lang.Class<? extends E1> e1Class,
                                                                                                                java.lang.Class<? extends E2> e2Class)
                                                                                                         throws E1 extends java.lang.Exception,
                                                                                                                E2 extends java.lang.Exception
        Throws:
        E1 extends java.lang.Exception
      • runSafely

        public static <R,​E1 extends java.lang.Exception,​E2 extends java.lang.Exception,​E3 extends java.lang.Exception> R runSafely​(ExceptionUtil.Block<R,​E1,​E2,​E3> block,
                                                                                                                                                     ExceptionUtil.CatchBlock catchBlock,
                                                                                                                                                     ExceptionUtil.FinallyBlock finallyBlock,
                                                                                                                                                     java.lang.Class<? extends E1> e1Class,
                                                                                                                                                     java.lang.Class<? extends E2> e2Class,
                                                                                                                                                     java.lang.Class<? extends E3> e3Class)
                                                                                                                                              throws E1 extends java.lang.Exception,
                                                                                                                                                     E2 extends java.lang.Exception,
                                                                                                                                                     E3 extends java.lang.Exception
        Throws:
        E1 extends java.lang.Exception