Package com.enonic.xp.util
Class Exceptions
- java.lang.Object
-
- com.enonic.xp.util.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.
-
-
-
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 newRuntimeException
. This method never returns. Nevertheless, it specifies a return type so it can be invoked asthrow 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.
-
-