public interface InvocationInterceptor
InvocationHandler.| Modifier and Type | Method and Description |
|---|---|
Object |
invoke(Object proxy,
Method method,
Object[] args,
InvocationHandler delegate)
This method can intercept the invocation of
InvocationHandler either before or after
the invocation happens. |
Object invoke(Object proxy, Method method, Object[] args, InvocationHandler delegate) throws Throwable
InvocationHandler either before or after
the invocation happens.
The general coding pattern is:
Object invoke(Object proxy, Method method, Object[] args, InvocationHandler delegate) {
... do pre-invocation work ...
ret = delegate.invoke(proxy,method,args);
... do post-invocation work ...
return ret;
}
But the implementation may choose to skip calling the 'delegate' object, alter arguments, and alter the return value.
ThrowableCopyright © 2019. All rights reserved.