public abstract class ThrowUnchecked extends Object
Example:
public <E extends Throwable> void someMethod(E exception) throws E { ... // Apparent compiler bug sometimes disallows this. Doesn't appear to // show up when compiling source files individually. //throw exception; // Throw it this way instead, and compiler doesn't know. ThrowUnchecked.fire(exception); }
Modifier | Constructor and Description |
---|---|
protected |
ThrowUnchecked() |
Modifier and Type | Method and Description |
---|---|
protected abstract void |
doFire(Throwable t) |
static void |
fire(Throwable t)
Throws the given exception, even though it may be checked.
|
static void |
fireCause(Throwable t)
Throws the cause of the given exception, even though it may be
checked.
|
static void |
fireDeclared(Throwable t,
Class... declaredTypes)
Throws the given exception if it is unchecked or an instance of any of
the given declared types.
|
static void |
fireDeclaredCause(Throwable t,
Class... declaredTypes)
Throws the cause of the given exception if it is unchecked or an
instance of any of the given declared types.
|
static void |
fireDeclaredRootCause(Throwable t,
Class... declaredTypes)
Throws the root cause of the given exception if it is unchecked or an
instance of any of the given declared types.
|
static void |
fireFirstDeclared(Throwable t,
Class... declaredTypes)
Throws the either the original exception or the first found cause if it
matches one of the given declared types or is unchecked.
|
static void |
fireFirstDeclaredCause(Throwable t,
Class... declaredTypes)
Throws the first found cause that matches one of the given declared
types or is unchecked.
|
static void |
fireRootCause(Throwable t)
Throws the root cause of the given exception, even though it may be
checked.
|
public static void fire(Throwable t)
t
- exception to throwpublic static void fireDeclared(Throwable t, Class... declaredTypes)
t
- exception to throwdeclaredTypes
- if exception is checked and is not an instance of
any of these types, then it is thrown as an
UndeclaredThrowableException.public static void fireFirstDeclared(Throwable t, Class... declaredTypes)
t
- exception whose cause is to be throwndeclaredTypes
- if exception is checked and is not an instance of
any of these types, then it is thrown as an
UndeclaredThrowableException.public static void fireCause(Throwable t)
t
- exception whose cause is to be thrownpublic static void fireDeclaredCause(Throwable t, Class... declaredTypes)
t
- exception whose cause is to be throwndeclaredTypes
- if exception is checked and is not an instance of
any of these types, then it is thrown as an
UndeclaredThrowableException.public static void fireFirstDeclaredCause(Throwable t, Class... declaredTypes)
t
- exception whose cause is to be throwndeclaredTypes
- if exception is checked and is not an instance of
any of these types, then it is thrown as an
UndeclaredThrowableException.public static void fireRootCause(Throwable t)
t
- exception whose root cause is to be thrownpublic static void fireDeclaredRootCause(Throwable t, Class... declaredTypes)
t
- exception whose root cause is to be throwndeclaredTypes
- if exception is checked and is not an instance of
any of these types, then it is thrown as an
UndeclaredThrowableException.protected abstract void doFire(Throwable t)
Copyright © 2004-2015 Cojen. All Rights Reserved.