private void validateInterceptor(Interceptor<?> interceptor) { Set<Annotation> bindings = interceptor.getInterceptorBindings(); if (bindings == null) { throw InterceptorLogger.LOG.nullInterceptorBindings(interceptor); } for (Annotation annotation : bindings) { if (!getBeanManager().isInterceptorBinding(annotation.annotationType())) { throw MetadataLogger.LOG.notAnInterceptorBinding(annotation, interceptor); } } }
protected Object invokeNext(InvocationContext invocationContext) throws Exception { int oldCurrentPosition = currentPosition; try { InterceptorMethodInvocation nextInterceptorMethodInvocation = interceptorMethodInvocations.get(currentPosition++); InterceptorLogger.LOG.invokingNextInterceptorInChain( nextInterceptorMethodInvocation.toString()); if (nextInterceptorMethodInvocation.expectsInvocationContext()) { return nextInterceptorMethodInvocation.invoke(invocationContext); } else { nextInterceptorMethodInvocation.invoke(null); while (hasNextInterceptor()) { nextInterceptorMethodInvocation = interceptorMethodInvocations.get(currentPosition++); nextInterceptorMethodInvocation.invoke(null); } return null; } } finally { currentPosition = oldCurrentPosition; } }