openwebbeans-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rmannibu...@apache.org
Subject svn commit: r1664461 - in /openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans: portable/BaseProducerProducer.java util/WebBeansUtil.java
Date Thu, 05 Mar 2015 19:40:28 GMT
Author: rmannibucau
Date: Thu Mar  5 19:40:28 2015
New Revision: 1664461

URL: http://svn.apache.org/r1664461
Log:
filling dispose param in container event for producer field

Modified:
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/portable/BaseProducerProducer.java
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/WebBeansUtil.java

Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/portable/BaseProducerProducer.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/portable/BaseProducerProducer.java?rev=1664461&r1=1664460&r2=1664461&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/portable/BaseProducerProducer.java
(original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/portable/BaseProducerProducer.java
Thu Mar  5 19:40:28 2015
@@ -44,6 +44,7 @@ public abstract class BaseProducerProduc
     protected Method disposalMethod;
     protected Set<InjectionPoint> disposalIPs;
     protected boolean isAnyDisposal;
+    protected AnnotatedMethod<? super P> disposerMethod;
 
     public BaseProducerProducer(Bean<P> owner,
                                 AnnotatedMethod<? super P> disposerMethod,
@@ -83,6 +84,12 @@ public abstract class BaseProducerProduc
                 }
             }
         }
+        this.disposerMethod = disposerMethod;
+    }
+
+    public AnnotatedMethod<? super P> getDisposerMethod()
+    {
+        return disposerMethod;
     }
 
     @Override

Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/WebBeansUtil.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/WebBeansUtil.java?rev=1664461&r1=1664460&r2=1664461&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/WebBeansUtil.java
(original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/WebBeansUtil.java
Thu Mar  5 19:40:28 2015
@@ -64,6 +64,7 @@ import org.apache.webbeans.inject.Altern
 import org.apache.webbeans.plugins.PluginLoader;
 import org.apache.webbeans.portable.AbstractProducer;
 import org.apache.webbeans.portable.InjectionTargetImpl;
+import org.apache.webbeans.portable.ProducerFieldProducer;
 import org.apache.webbeans.portable.events.ProcessBeanAttributesImpl;
 import org.apache.webbeans.portable.events.discovery.ErrorStack;
 import org.apache.webbeans.portable.events.generics.GProcessAnnotatedType;
@@ -98,6 +99,7 @@ import javax.enterprise.inject.spi.Annot
 import javax.enterprise.inject.spi.AnnotatedField;
 import javax.enterprise.inject.spi.AnnotatedMember;
 import javax.enterprise.inject.spi.AnnotatedMethod;
+import javax.enterprise.inject.spi.AnnotatedParameter;
 import javax.enterprise.inject.spi.AnnotatedType;
 import javax.enterprise.inject.spi.Bean;
 import javax.enterprise.inject.spi.BeanAttributes;
@@ -1115,7 +1117,18 @@ public final class WebBeansUtil
             ProducerFieldBean<?> bean = beanEntry.getKey();
             AnnotatedField<?> field = beanEntry.getValue();
 
-            GProcessProducerField processProducerFieldEvent = new GProcessProducerField(bean,
field, null);
+            Producer<?> producer = bean.getProducer();
+            AnnotatedParameter<?> param = null;
+            if (ProducerFieldProducer.class.isInstance(producer))
+            {
+                ProducerFieldProducer fieldProducer = ProducerFieldProducer.class.cast(producer);
+                AnnotatedMethod<?> dm = fieldProducer.getDisposerMethod();
+                if (dm != null && dm.getParameters() != null && !dm.getParameters().isEmpty())
+                {
+                    param = dm.getParameters().iterator().next();
+                }
+            }
+            GProcessProducerField processProducerFieldEvent = new GProcessProducerField(bean,
field, param);
 
             //Fire ProcessProducer
             webBeansContext.getBeanManagerImpl().fireEvent(processProducerFieldEvent, true,
AnnotationUtil.EMPTY_ANNOTATION_ARRAY);



Mime
View raw message