public class ScopedWorkException extends RuntimeException
Exception| Constructor and Description |
|---|
ScopedWorkException(String message,
Throwable cause,
TransactionContext context)
Creates a new TransactionException with the supplied message and cause
|
| Modifier and Type | Method and Description |
|---|---|
<T extends Throwable> |
as(Class<T> throwable)
Throws the cause of this Exception as a RuntimeException, or as the supplied
Exception type.
|
<A extends Throwable,B extends Throwable> |
asOneOf(Class<A> a,
Class<B> b)
Throws the cause of this Exception as a RuntimeException, or as one of the
supplied Exception types.
|
<A extends Throwable,B extends Throwable,C extends Throwable> |
asOneOf(Class<A> a,
Class<B> b,
Class<C> c)
Throws the cause of this Exception as a RuntimeException or one of the
supplied Exception types.
|
<A extends Throwable,B extends Throwable,C extends Throwable,D extends Throwable> |
asOneOf(Class<A> a,
Class<B> b,
Class<C> c,
Class<D> d)
Throws the cause of this Exception as a RuntimeException or one of the
supplied Exception types.
|
RuntimeException |
asRuntimeException() |
TransactionContext |
ongoingContext() |
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toStringpublic ScopedWorkException(String message, Throwable cause, TransactionContext context)
message - cause - context - public TransactionContext ongoingContext()
null otherwise.
Note that this property will not be persisted during serialization.public RuntimeException asRuntimeException()
RuntimeException if it
is one, or this otherwisepublic <T extends Throwable> T as(Class<T> throwable) throws T extends Throwable, IllegalArgumentException
Usage is of the form:
public void doStuff() throws IOException {
try {
...
} catch (ScopedWorkException swe) {
throw swe.as(IOException.class);
}
}
throwable - The exception type to throwthisT - the type of exception to be thrownIllegalArgumentException - if the cause is not a RuntimeException or of type TT extends Throwablepublic <A extends Throwable,B extends Throwable> RuntimeException asOneOf(Class<A> a, Class<B> b) throws A extends Throwable, B extends Throwable, IllegalArgumentException
Usage is of the form:
public void doStuff() throws IOException, ClassNotFoundException {
try {
...
} catch (ScopedWorkException swe) {
throw swe.asOneOf(IOException.class, ClassNotFoundException.class);
}
}
a - The first possible exception type to throwb - The second possible exception type to throwthisA - The first possible exception type to throwB - The second possible exception type to throwIllegalArgumentException - if the cause is not a RuntimeException or of type A or BA extends Throwablepublic <A extends Throwable,B extends Throwable,C extends Throwable> RuntimeException asOneOf(Class<A> a, Class<B> b, Class<C> c) throws A extends Throwable, B extends Throwable, C extends Throwable, IllegalArgumentException
a - The first possible exception type to throwb - The second possible exception type to throwc - The third possible exception type to throwthisA - The first possible exception type to throwB - The second possible exception type to throwC - The third possible exception type to throwIllegalArgumentException - if the cause is not a RuntimeException or one of types A, B or CA extends ThrowableasOneOf(Class, Class)public <A extends Throwable,B extends Throwable,C extends Throwable,D extends Throwable> RuntimeException asOneOf(Class<A> a, Class<B> b, Class<C> c, Class<D> d) throws A extends Throwable, B extends Throwable, C extends Throwable, D extends Throwable, IllegalArgumentException
a - The first possible exception type to throwb - The second possible exception type to throwc - The third possible exception type to throwd - The fourth possible exception type to throwthisA - The first possible exception type to throwB - The second possible exception type to throwC - The third possible exception type to throwD - The fourth possible exception type to throwIllegalArgumentException - if the cause is not a RuntimeException or one of types A, B, C or DA extends ThrowableasOneOf(Class, Class)Copyright © 2016 The Apache Software Foundation. All rights reserved.