Interface InvocationContext


public interface InvocationContext
Exposes contextual information about the intercepted invocation and operations that enable interceptor methods to control the behavior of the invocation chain.

    @AroundInvoke
    public Object logInvocation(InvocationContext ctx) throws Exception {
       String class = ctx.getMethod().getDeclaringClass().getName();
       String method = ctx.getMethod().getName();
       Logger.global.entering(class, method, ctx.getParameters());
       try {
          Object result = ctx.proceed();
          Logger.global.exiting(class, method, result);
          return result;
       }
       catch (Exception e) {
          Logger.global.throwing(class, method, e);
          throw e;
       }

    }

 
Since:
Jakarta Interceptors 1.0