openwebbeans-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rmannibu...@apache.org
Subject svn commit: r1648005 - /openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/portable/AbstractProducer.java
Date Fri, 26 Dec 2014 18:09:17 GMT
Author: rmannibucau
Date: Fri Dec 26 18:09:16 2014
New Revision: 1648005

URL: http://svn.apache.org/r1648005
Log:
exposing createInterceptorInstances to subclasses since otherwise no way to reuse @AroundConstruct
init logic without having issues with decorators

Modified:
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/portable/AbstractProducer.java

Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/portable/AbstractProducer.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/portable/AbstractProducer.java?rev=1648005&r1=1648004&r2=1648005&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/portable/AbstractProducer.java
(original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/portable/AbstractProducer.java
Fri Dec 26 18:09:16 2014
@@ -164,32 +164,9 @@ public abstract class AbstractProducer<T
     {
         final CreationalContextImpl<T> creationalContextImpl = (CreationalContextImpl<T>)
creationalContext;
 
-        final Map<Interceptor<?>,Object> interceptorInstances  = new HashMap<Interceptor<?>,
Object>();
         final Contextual<T> oldContextual = creationalContextImpl.getContextual();
 
-        if (interceptorInfo != null)
-        {
-            // apply interceptorInfo
-
-            // create EJB-style interceptors
-            for (final Interceptor interceptorBean : interceptorInfo.getEjbInterceptors())
-            {
-                creationalContextImpl.putContextual(interceptorBean);
-                interceptorInstances.put(interceptorBean, interceptorBean.create(creationalContext));
-            }
-
-            // create CDI-style interceptors
-            for (final Interceptor interceptorBean : interceptorInfo.getCdiInterceptors())
-            {
-                creationalContextImpl.putContextual(interceptorBean);
-                interceptorInstances.put(interceptorBean, interceptorBean.create(creationalContext));
-            }
-            for (final Interceptor interceptorBean : interceptorInfo.getConstructorCdiInterceptors())
-            {
-                creationalContextImpl.putContextual(interceptorBean);
-                interceptorInstances.put(interceptorBean, interceptorBean.create(creationalContext));
-            }
-        }
+        final Map<Interceptor<?>, Object> interceptorInstances = createInterceptorInstances(creationalContextImpl);
         creationalContextImpl.putContextual(oldContextual);
 
         T instance = produce(interceptorInstances, creationalContextImpl);
@@ -228,6 +205,35 @@ public abstract class AbstractProducer<T
         return instance;
     }
 
+    protected Map<Interceptor<?>, Object> createInterceptorInstances(CreationalContextImpl<T>
creationalContextImpl)
+    {
+        final Map<Interceptor<?>,Object> interceptorInstances  = new HashMap<Interceptor<?>,
Object>();
+        if (interceptorInfo != null)
+        {
+            // apply interceptorInfo
+
+            // create EJB-style interceptors
+            for (final Interceptor interceptorBean : interceptorInfo.getEjbInterceptors())
+            {
+                creationalContextImpl.putContextual(interceptorBean);
+                interceptorInstances.put(interceptorBean, interceptorBean.create(creationalContextImpl));
+            }
+
+            // create CDI-style interceptors
+            for (final Interceptor interceptorBean : interceptorInfo.getCdiInterceptors())
+            {
+                creationalContextImpl.putContextual(interceptorBean);
+                interceptorInstances.put(interceptorBean, interceptorBean.create(creationalContextImpl));
+            }
+            for (final Interceptor interceptorBean : interceptorInfo.getConstructorCdiInterceptors())
+            {
+                creationalContextImpl.putContextual(interceptorBean);
+                interceptorInstances.put(interceptorBean, interceptorBean.create(creationalContextImpl));
+            }
+        }
+        return interceptorInstances;
+    }
+
     protected List<Decorator<?>> filterDecorators(final T instance, final List<Decorator<?>>
decorators)
     {
         return decorators;



Mime
View raw message