Exception.
If the scope was inherited and therefore is still active when this exception
is raised then the current TransactionContext will be available from
the ongoingContext() method.
| Modifier and Type | Field and Description |
|---|---|
| private final transient TransactionContext | context
|
| private static final long |
| Access | Constructor and Description |
|---|---|
| public | ScopedWorkException(String message, Throwable cause, TransactionContext context)
Creates a new TransactionException with the supplied message and cause |
| Modifier and Type | Method and Description |
|---|---|
| public <T extends Throwable> T | |
| public <A extends Throwable, B extends Throwable> RuntimeException | |
| public <A extends Throwable, B extends Throwable, C extends Throwable> RuntimeException | |
| public <A extends Throwable, B extends Throwable, C extends Throwable, D extends Throwable> RuntimeException | |
| public RuntimeException | Returns: The cause of this Exception as aRuntimeException if it
is one, or this otherwise
|
| public TransactionContext | Returns: The ongoing transaction context if the current scope was still active when this exception was raised ornull otherwise.
Note that this property will not be persisted during serialization.
|
| private static <E extends Throwable> RuntimeException |
| context | back to summary |
|---|---|
| private final transient TransactionContext context
| |
| serialVersionUID | back to summary |
|---|---|
| private static final long serialVersionUID | |
| ScopedWorkException | back to summary |
|---|---|
| public ScopedWorkException(String message, Throwable cause, TransactionContext context) Creates a new TransactionException with the supplied message and cause | |
| as | back to summary |
|---|---|
| public <T extends Throwable> T as(Class<T> throwable) throws Class-:T Throws the cause of this Exception as a RuntimeException the supplied Exception type. Usage is of the form:
public void doStuff() throws IOException {
try {
...
} catch (ScopedWorkException swe) {
throw swe.as(IOException.class);
}
}
| |
| asOneOf | back to summary |
|---|---|
| public <A extends Throwable, B extends Throwable> RuntimeException asOneOf(Class<A> a, Class<B> b) throws Class-:A, Class-:B Throws the cause of this Exception as a RuntimeException or one of the supplied Exception types. Usage is of the form:
public void doStuff() throws IOException, ClassNotFoundException {
try {
...
} catch (ScopedWorkException swe) {
throw swe.asOneOf(IOException.class, ClassNotFoundException.class);
}
}
| |
| asOneOf | back to summary |
|---|---|
| public <A extends Throwable, B extends Throwable, C extends Throwable> RuntimeException asOneOf(Class<A> a, Class<B> b, Class<C> c) throws Class-:A, Class-:B, Class-:C Throws the cause of this Exception as a RuntimeException or one of the supplied Exception types.
| |
| asOneOf | back to summary |
|---|---|
| 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 Class-:A, Class-:B, Class-:C, Class-:D Throws the cause of this Exception as a RuntimeException or one of the supplied Exception types.
| |
| asRuntimeException | back to summary |
|---|---|
public RuntimeException asRuntimeException()
| |
| ongoingContext | back to summary |
|---|---|
public TransactionContext ongoingContext()
| |
| throwCause | back to summary |
|---|---|
private static <E extends Throwable> RuntimeException throwCause(Throwable e) throws Throwable-:E
| |