X
- Exception typepublic final class ReflectiveExceptionMapper<X extends Exception> extends ExceptionMapper<X>
ExceptionMapper
which instantiates specified Exception using
reflection. The Exception types are expected to declare an accessible constructor
which takes two arguments: a String and a Throwable.Modifier and Type | Method and Description |
---|---|
static <X extends Exception> |
create(String opName,
Class<X> exceptionType)
Create a new instance of the reflective exception mapper.
|
protected X |
newWithCause(String message,
Throwable cause)
Invoked to create a new exception instance of the specified type.
|
apply, getExceptionType
protected X newWithCause(String message, Throwable cause)
ExceptionMapper
newWithCause
in class ExceptionMapper<X extends Exception>
message
- the message for the new exception.cause
- the cause for the new exception.public static <X extends Exception> ReflectiveExceptionMapper<X> create(String opName, Class<X> exceptionType) throws SecurityException
opName
- Operation performedexceptionType
- Exception typeIllegalArgumentException
- when the supplied exception class does not pass sanity checksSecurityException
- when the required constructor is not accessibleCopyright © 2017 OpenDaylight. All rights reserved.