openwebbeans-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rmannibu...@apache.org
Subject svn commit: r1606402 - in /openwebbeans/trunk: webbeans-impl/src/main/java/org/apache/webbeans/intercept/InterceptorResolutionService.java webbeans-tck/testng-dev.xml
Date Sat, 28 Jun 2014 22:01:40 GMT
Author: rmannibucau
Date: Sat Jun 28 22:01:40 2014
New Revision: 1606402

URL: http://svn.apache.org/r1606402
Log:
constructor can get interceptor binding too

Modified:
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/InterceptorResolutionService.java
    openwebbeans/trunk/webbeans-tck/testng-dev.xml

Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/InterceptorResolutionService.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/InterceptorResolutionService.java?rev=1606402&r1=1606401&r2=1606402&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/InterceptorResolutionService.java
(original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/InterceptorResolutionService.java
Sat Jun 28 22:01:40 2014
@@ -111,7 +111,7 @@ public class InterceptorResolutionServic
         // pick up CDI interceptors from a class level
         Set<Annotation> classInterceptorBindings = annotationManager.getInterceptorAnnotations(annotatedType.getAnnotations());
         Set<Interceptor<?>> allUsedCdiInterceptors = new HashSet<Interceptor<?>>();
-        addCdiClassLifecycleInterceptors(classInterceptorBindings, allUsedCdiInterceptors);
+        addCdiClassLifecycleInterceptors(annotatedType, classInterceptorBindings, allUsedCdiInterceptors);
 
         LinkedHashSet<Interceptor<?>> allUsedEjbInterceptors = new LinkedHashSet<Interceptor<?>>();
// we need to preserve the order!
         allUsedEjbInterceptors.addAll(classLevelEjbInterceptors);
@@ -217,7 +217,9 @@ public class InterceptorResolutionServic
     }
 
 
-    private void addCdiClassLifecycleInterceptors(Set<Annotation> classInterceptorBindings,
Set<Interceptor<?>> allUsedCdiInterceptors)
+    private <T> void addCdiClassLifecycleInterceptors(AnnotatedType<T> annotatedType,
+                                                      Set<Annotation> classInterceptorBindings,
+                                                      Set<Interceptor<?>> allUsedCdiInterceptors)
     {
         if (classInterceptorBindings.size() > 0)
         {
@@ -226,7 +228,27 @@ public class InterceptorResolutionServic
 
             allUsedCdiInterceptors.addAll(beanManagerImpl.resolveInterceptors(InterceptionType.POST_CONSTRUCT,
interceptorBindings));
             allUsedCdiInterceptors.addAll(beanManagerImpl.resolveInterceptors(InterceptionType.PRE_DESTROY,
interceptorBindings));
-            allUsedCdiInterceptors.addAll(beanManagerImpl.resolveInterceptors(InterceptionType.AROUND_CONSTRUCT,
interceptorBindings));
+
+            if (!annotatedType.getConstructors().isEmpty())
+            {
+                for (final AnnotatedConstructor<?> c : annotatedType.getConstructors())
+                {
+                    final Set<Annotation> constructorAnnot = webBeansContext.getAnnotationManager().getInterceptorAnnotations(c.getAnnotations());
+                    if (constructorAnnot.isEmpty())
+                    {
+                        allUsedCdiInterceptors.addAll(beanManagerImpl.resolveInterceptors(InterceptionType.AROUND_CONSTRUCT,
interceptorBindings));
+                    }
+                    else
+                    {
+                        constructorAnnot.addAll(classInterceptorBindings);
+                        allUsedCdiInterceptors.addAll(beanManagerImpl.resolveInterceptors(InterceptionType.AROUND_CONSTRUCT,
AnnotationUtil.asArray(constructorAnnot)));
+                    }
+                }
+            }
+            else
+            {
+                allUsedCdiInterceptors.addAll(beanManagerImpl.resolveInterceptors(InterceptionType.AROUND_CONSTRUCT,
interceptorBindings));
+            }
         }
     }
 

Modified: openwebbeans/trunk/webbeans-tck/testng-dev.xml
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-tck/testng-dev.xml?rev=1606402&r1=1606401&r2=1606402&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-tck/testng-dev.xml (original)
+++ openwebbeans/trunk/webbeans-tck/testng-dev.xml Sat Jun 28 22:01:40 2014
@@ -19,7 +19,7 @@
   <test name="JSR-346 TCK">
     <classes>
       <class
-          name="org.jboss.cdi.tck.interceptors.tests.contract.interceptorLifeCycle.aroundConstruct.AroundConstructLifeCycleTest"/>
+          name="org.jboss.cdi.tck.interceptors.tests.bindings.resolution.InterceptorBindingResolutionTest"/>
     </classes>
     <groups>
       <run>



Mime
View raw message