Package hudson.util

Interface InvocationInterceptor


  • public interface InvocationInterceptor
    Interceptor around InvocationHandler.
    Since:
    1.232
    Author:
    Kohsuke Kawaguchi
    • Method Detail

      • invoke

        Object invoke​(Object proxy,
                      Method method,
                      Object[] args,
                      InvocationHandler delegate)
               throws Throwable
        This method can intercept the invocation of 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.

        Throws:
        Throwable