Class Exceptions


  • @Beta
    public abstract class Exceptions
    extends java.lang.Object
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      static class  Exceptions.Builder<T extends java.lang.Throwable>  
    • Constructor Summary

      Constructors 
      Constructor Description
      Exceptions()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static Exceptions.Builder<java.lang.RuntimeException> newRuntime​(java.lang.String message, java.lang.Object... args)  
      static java.lang.RuntimeException unchecked​(java.lang.Throwable e)
      Rethrows a checked exception as unchecked exception.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • Exceptions

        public Exceptions()
    • Method Detail

      • newRuntime

        public static Exceptions.Builder<java.lang.RuntimeException> newRuntime​(java.lang.String message,
                                                                                java.lang.Object... args)
      • unchecked

        public static java.lang.RuntimeException unchecked​(java.lang.Throwable e)
        Rethrows a checked exception as unchecked exception. This method tricks the compiler into thinking the exception is unchecked, rather than wrapping the given exception in a new RuntimeException. This method never returns. Nevertheless, it specifies a return type so it can be invoked as throw unchecked(e) in contexts where an exception type is syntactically required (e.g. when the enclosing method is non-void).
        Parameters:
        e - Throwable to be made unchecked.
        Returns:
        This will never return anything. It's here to trick the compiler.