Interface MethodInterceptor

  • All Known Implementing Classes:
    DefaultMethodInvokingInterceptor

    public interface MethodInterceptor
    Intercepts calls on an interface on its way to the target. These are nested "on top" of the target.

    Implementing classes are required to implement the invoke(MethodInvocation) method to modify the original behavior.

    Since:
    5.0
    Author:
    Mark Paluch
    • Method Detail

      • invoke

        Object invoke​(MethodInvocation invocation)
               throws Throwable
        Implement this method to perform extra treatments before and after the invocation. Polite implementations would certainly like to invoke MethodInvocation.proceed().
        Parameters:
        invocation - the method invocation
        Returns:
        the result of the call to MethodInvocation.proceed(), might be intercepted by the interceptor.
        Throws:
        Throwable - if the interceptors or the target-object throws an exception.