@ProviderType public class ScopedWorkException extends java.lang.RuntimeException
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.
Constructor and Description |
---|
ScopedWorkException(java.lang.String message,
java.lang.Throwable cause,
TransactionContext context)
Creates a new TransactionException with the supplied message and cause
|
Modifier and Type | Method and Description |
---|---|
<T extends java.lang.Throwable> |
as(java.lang.Class<T> throwable)
Throws the cause of this Exception as a RuntimeException the supplied
Exception type.
|
<A extends java.lang.Throwable,B extends java.lang.Throwable> |
asOneOf(java.lang.Class<A> a,
java.lang.Class<B> b)
Throws the cause of this Exception as a RuntimeException or one of the
supplied Exception types.
|
<A extends java.lang.Throwable,B extends java.lang.Throwable,C extends java.lang.Throwable> |
asOneOf(java.lang.Class<A> a,
java.lang.Class<B> b,
java.lang.Class<C> c)
Throws the cause of this Exception as a RuntimeException or one of the
supplied Exception types.
|
<A extends java.lang.Throwable,B extends java.lang.Throwable,C extends java.lang.Throwable,D extends java.lang.Throwable> |
asOneOf(java.lang.Class<A> a,
java.lang.Class<B> b,
java.lang.Class<C> c,
java.lang.Class<D> d)
Throws the cause of this Exception as a RuntimeException or one of the
supplied Exception types.
|
java.lang.RuntimeException |
asRuntimeException() |
TransactionContext |
ongoingContext() |
public ScopedWorkException(java.lang.String message, java.lang.Throwable cause, TransactionContext context)
message
- cause
- context
- public TransactionContext ongoingContext()
null
otherwise.
Note that this property will not be persisted during serialization.public java.lang.RuntimeException asRuntimeException()
RuntimeException
if it
is one, or this otherwisepublic <T extends java.lang.Throwable> T as(java.lang.Class<T> throwable) throws T extends java.lang.Throwable
Usage is of the form:
public void doStuff() throws IOException { try { ... } catch (ScopedWorkException swe) { throw swe.as(IOException.class); } }
throwable
- T
T extends java.lang.Throwable
public <A extends java.lang.Throwable,B extends java.lang.Throwable> java.lang.RuntimeException asOneOf(java.lang.Class<A> a, java.lang.Class<B> b) throws A extends java.lang.Throwable, B extends java.lang.Throwable
Usage is of the form:
public void doStuff() throws IOException, ClassNotFoundException { try { ... } catch (ScopedWorkException swe) { throw swe.asOneOf(IOException.class, ClassNotFoundException.class); } }
a
- b
- A
B
A extends java.lang.Throwable
public <A extends java.lang.Throwable,B extends java.lang.Throwable,C extends java.lang.Throwable> java.lang.RuntimeException asOneOf(java.lang.Class<A> a, java.lang.Class<B> b, java.lang.Class<C> c) throws A extends java.lang.Throwable, B extends java.lang.Throwable, C extends java.lang.Throwable
a
- b
- c
- A
B
A extends java.lang.Throwable
asOneOf(Class, Class)
public <A extends java.lang.Throwable,B extends java.lang.Throwable,C extends java.lang.Throwable,D extends java.lang.Throwable> java.lang.RuntimeException asOneOf(java.lang.Class<A> a, java.lang.Class<B> b, java.lang.Class<C> c, java.lang.Class<D> d) throws A extends java.lang.Throwable, B extends java.lang.Throwable, C extends java.lang.Throwable, D extends java.lang.Throwable
a
- b
- c
- d
- A
B
C
D
A extends java.lang.Throwable
asOneOf(Class, Class)
Copyright © OSGi Alliance (2000, 2018). All Rights Reserved. Licensed under the OSGi Specification License, Version 2.0