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