openwebbeans-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From strub...@apache.org
Subject svn commit: r1432414 - in /openwebbeans/trunk/webbeans-impl/src: main/java/org/apache/webbeans/component/creation/InterceptorBeanBuilder.java test/java/org/apache/webbeans/newtests/interceptors/common/DependentInterceptor.java
Date Sat, 12 Jan 2013 12:19:11 GMT
Author: struberg
Date: Sat Jan 12 12:19:11 2013
New Revision: 1432414

URL: http://svn.apache.org/viewvc?rev=1432414&view=rev
Log:
OWB-344 set interceptorMethods and InterceptionTypes in the InterceptorBean

Modified:
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/creation/InterceptorBeanBuilder.java
    openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/common/DependentInterceptor.java

Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/creation/InterceptorBeanBuilder.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/creation/InterceptorBeanBuilder.java?rev=1432414&r1=1432413&r2=1432414&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/creation/InterceptorBeanBuilder.java
(original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/creation/InterceptorBeanBuilder.java
Sat Jan 12 12:19:11 2013
@@ -207,10 +207,51 @@ public abstract class InterceptorBeanBui
             intercepts.add(InterceptionType.AROUND_INVOKE);
         }
 
+        if (postConstructMethods.size() > 0)
+        {
+            bean.setPostConstructMethods(getMethodArray(postConstructMethods));
+            intercepts.add(InterceptionType.POST_CONSTRUCT);
+        }
+        if (preDestroyMethods.size() > 0)
+        {
+            bean.setPreDestroyMethods(getMethodArray(preDestroyMethods));
+            intercepts.add(InterceptionType.PRE_DESTROY);
+        }
+        if (aroundTimeoutMethods.size() > 0)
+        {
+            bean.setAroundTimeoutMethods(getMethodArray(aroundTimeoutMethods));
+            intercepts.add(InterceptionType.AROUND_TIMEOUT);
+        }
+
+        if (prePassivateMethods.size() > 0)
+        {
+            bean.setPrePassivateMethods(getMethodArray(prePassivateMethods));
+            intercepts.add(InterceptionType.PRE_PASSIVATE);
+        }
+        if (postActivateMethods.size() > 0)
+        {
+            bean.setPostActivateMethods(getMethodArray(postActivateMethods));
+            intercepts.add(InterceptionType.POST_ACTIVATE);
+        }
+
         bean.setIntercepts(intercepts);
     }
 
     /**
+     * @return the a Method array with the native members of the AnnotatedMethod list
+     */
+    private Method[] getMethodArray(List<AnnotatedMethod> methodList)
+    {
+        Method[] methods = new Method[methodList.size()];
+        int i=0;
+        for (AnnotatedMethod am : methodList)
+        {
+            methods[i++] = am.getJavaMember();
+        }
+        return methods;
+    }
+
+    /**
      *
      * @return
      */

Modified: openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/common/DependentInterceptor.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/common/DependentInterceptor.java?rev=1432414&r1=1432413&r2=1432414&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/common/DependentInterceptor.java
(original)
+++ openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/common/DependentInterceptor.java
Sat Jan 12 12:19:11 2013
@@ -18,6 +18,7 @@
  */
 package org.apache.webbeans.newtests.interceptors.common;
 
+import javax.interceptor.AroundInvoke;
 import javax.interceptor.Interceptor;
 import javax.interceptor.InvocationContext;
 
@@ -34,7 +35,8 @@ public class DependentInterceptor
     {
         refCount++;
     }
-    
+
+    @AroundInvoke
     public Object aroundInvoke(InvocationContext ctx) throws Exception
     {
         DEP_OK = true;



Mime
View raw message