Interceptor interceptor = Interceptor.class.cast(container.instanceFor(type));
if (interceptor == null) {
throw new InterceptionException("Unable to instantiate interceptor for " + type.getName()
+ ": the container returned null.");
}
if (interceptor.accepts(method)) {
logger.debug("Invoking interceptor {}", interceptor.getClass().getSimpleName());
interceptor.intercept(stack, method, resourceInstance);
} else {
stack.next(method, resourceInstance);
}