private void processForAnnotations(AnnotationInfo element, AccessibleObject o, Map<AccessibleObject, Class[]> methodLevelInterceptors, ManagedBeanDescriptor managedBeanDesc, Class managedBeanClass) throws AnnotationProcessorException { Annotation ann = getMethodAnnotation(o, "javax.interceptor.Interceptors"); if(ann != null) { try { Method valueM = ann.annotationType().getDeclaredMethod("value"); methodLevelInterceptors.put(o, (Class[]) valueM.invoke(ann)); } catch(Exception e) { AnnotationProcessorException ape = new AnnotationProcessorException(e.getMessage(), element); ape.initCause(e); throw ape; } } else { // If the method or constructor excludes // class-level interceptors, explicitly set method-level to an empty list. boolean excludeClassInterceptors = ( getMethodAnnotation(o, "javax.interceptor.ExcludeClassInterceptors") != null ); if( excludeClassInterceptors ) { MethodDescriptor mDesc = getMethodDescriptor(o, managedBeanClass); if (mDesc != null) { managedBeanDesc.setMethodLevelInterceptorChain(mDesc, new LinkedList<InterceptorDescriptor>()); } } } }
return getDefaultProcessedResult(); Annotation interceptorsAnn = getClassAnnotation(managedBeanClass, "javax.interceptor.Interceptors"); if( interceptorsAnn != null ) { try { while(nextIntClass != Object.class) { Method managedBeanAroundInvoke = getMethodForMethodAnnotation(nextIntClass, "javax.interceptor.AroundInvoke"); if( (managedBeanAroundInvoke != null) && !(methodOverridden(managedBeanAroundInvoke, nextIntClass, managedBeanClass)) ) { processForAnnotations(element, m, methodLevelInterceptors, managedBeanDesc, managedBeanClass); processForAnnotations(element, c, methodLevelInterceptors, managedBeanDesc, managedBeanClass); InterceptorDescriptor nextInterceptor = processInterceptor(i, managedBeanContext, procContext); ( getMethodAnnotation(o, "javax.interceptor.ExcludeClassInterceptors") != null ); InterceptorDescriptor interceptorDesc = interceptorDescs.get(nextInterceptor.getName()); if( interceptorDesc == null ) { interceptorDesc = processInterceptor(nextInterceptor, managedBeanContext, procContext); interceptorDescs.put(nextInterceptor.getName(), interceptorDesc);
return getDefaultProcessedResult(); Annotation interceptorsAnn = getClassAnnotation(managedBeanClass, "javax.interceptor.Interceptors"); if( interceptorsAnn != null ) { try { while(nextIntClass != Object.class) { Method managedBeanAroundInvoke = getMethodForMethodAnnotation(nextIntClass, "javax.interceptor.AroundInvoke"); if( (managedBeanAroundInvoke != null) && !(methodOverridden(managedBeanAroundInvoke, nextIntClass, managedBeanClass)) ) { Annotation ann = getMethodAnnotation(m, "javax.interceptor.Interceptors"); if(ann != null) { try { ( getMethodAnnotation(m, "javax.interceptor.ExcludeClassInterceptors") != null ); if( excludeClassInterceptors ) { InterceptorDescriptor nextInterceptor = processInterceptor(i, managedBeanContext, procContext); ( getMethodAnnotation(m, "javax.interceptor.ExcludeClassInterceptors") != null ); InterceptorDescriptor interceptorDesc = interceptorDescs.get(nextInterceptor.getName()); if( interceptorDesc == null ) {
while(nextIntClass != Object.class) { Method interceptorAroundInvoke = getMethodForMethodAnnotation(nextIntClass, "javax.interceptor.AroundInvoke"); if( (interceptorAroundInvoke != null) && !(methodOverridden(interceptorAroundInvoke, nextIntClass, interceptorClass)) ) { getMethodForMethodAnnotation(nextIntClass, "javax.interceptor.AroundConstruct"); if( (interceptorAroundConstruct != null) && !(methodOverridden(interceptorAroundConstruct, nextIntClass, interceptorClass)) ) {
private InterceptorDescriptor processInterceptor(Class interceptorClass, ManagedBeanContext managedBeanCtx, ProcessingContext procCtx) throws AnnotationProcessorException { InterceptorDescriptor interceptorDesc = new InterceptorDescriptor(); interceptorDesc.setInterceptorClassName(interceptorClass.getName()); // Redirect PostConstruct / PreDestroy methods to InterceptorDescriptor // during annotation processing managedBeanCtx.setInterceptorMode(interceptorDesc); // Process annotations on interceptor procCtx.pushHandler(managedBeanCtx); procCtx.getProcessor().process(procCtx, new Class[] {interceptorClass}); managedBeanCtx.unsetInterceptorMode(); Class nextIntClass = interceptorClass; while(nextIntClass != Object.class) { Method interceptorAroundInvoke = getMethodForMethodAnnotation(nextIntClass, "javax.interceptor.AroundInvoke"); if( (interceptorAroundInvoke != null) && !(methodOverridden(interceptorAroundInvoke, nextIntClass, interceptorClass)) ) { LifecycleCallbackDescriptor desc = new LifecycleCallbackDescriptor(); desc.setLifecycleCallbackClass(nextIntClass.getName()); desc.setLifecycleCallbackMethod(interceptorAroundInvoke.getName()); interceptorDesc.addAroundInvokeDescriptor(desc); } nextIntClass = nextIntClass.getSuperclass(); } return interceptorDesc; }