E
- The type of the throwable that is caught and ,optionally, verified.class AbstractThrowableProcessingInvocationHandler<E extends Throwable> extends Object
Modifier and Type | Field and Description |
---|---|
protected boolean |
assertThrowable
|
protected Class<E> |
clazz
|
protected Object |
target
|
Constructor and Description |
---|
AbstractThrowableProcessingInvocationHandler(Object target,
Class<E> clazz,
boolean assertThrowable) |
Modifier and Type | Method and Description |
---|---|
protected Object |
afterInvocation(Object retval)
Must be called by the subclass after the method invocation that has not thrown a throwable.
|
protected Object |
afterInvocationThrowsThrowable(Throwable e,
Method method)
Must be called by the subclass after the intercepted method invocation that has thrown a throwable.
|
protected void |
beforeInvocation()
Must be called by the subclass before the intercepted method invocation.
|
(package private) Object |
safeReturnValue(Class<?> type) |
protected boolean assertThrowable
public AbstractThrowableProcessingInvocationHandler(Object target, Class<E> clazz, boolean assertThrowable)
target
- The object all method calls are delegated to. Must not be null
.clazz
- the type of the throwable that is to catch. Must not be null
.assertThrowable
- True if the interceptor shall throw an ThrowableNotThrownAssertionError
if the method has not
thrown an throwable of the expected type.protected void beforeInvocation()
protected Object afterInvocation(Object retval) throws Error
retval
- The value returned by the intercepted method invocation.Error
- (optionally) Thrown if the verification failed.protected Object afterInvocationThrowsThrowable(Throwable e, Method method) throws Error, Throwable
e
- the throwable thrown by the intercepted method invocation.method
- the method that was proxiedError
- Thrown if the verification failed.Throwable
- The given throwable. (Re-)thrown if the thrown throwable shall not be caught and verification is not
required.Object safeReturnValue(Class<?> type)
type
- a typeCopyright © 2014. All rights reserved.