openwebbeans-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rmannibu...@apache.org
Subject svn commit: r1468322 - /openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/portable/InjectionTargetImpl.java
Date Tue, 16 Apr 2013 07:44:41 GMT
Author: rmannibucau
Date: Tue Apr 16 07:44:40 2013
New Revision: 1468322

URL: http://svn.apache.org/r1468322
Log:
OWB-840 handle delegate creation through getInjectableReference

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

Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/portable/InjectionTargetImpl.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/portable/InjectionTargetImpl.java?rev=1468322&r1=1468321&r2=1468322&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/portable/InjectionTargetImpl.java
(original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/portable/InjectionTargetImpl.java
Tue Apr 16 07:44:40 2013
@@ -31,6 +31,7 @@ import java.util.List;
 import java.util.Map;
 import java.util.Set;
 
+import javax.decorator.Delegate;
 import javax.enterprise.context.spi.CreationalContext;
 import javax.enterprise.event.Observes;
 import javax.enterprise.inject.Disposes;
@@ -204,7 +205,7 @@ public class InjectionTargetImpl<T> exte
             }
 
             T delegate = instance;
-            if (interceptorInfo.getDecorators() != null)
+            if (interceptorInfo.getDecorators() != null && !isDelegateInjection(creationalContext))
             {
                 List<Decorator<?>> decorators = interceptorInfo.getDecorators();
                 Map<Decorator<?>, Object> instances = new HashMap<Decorator<?>,
Object>();
@@ -226,6 +227,26 @@ public class InjectionTargetImpl<T> exte
 
         return instance;
     }
+
+    protected boolean isDelegateInjection(final CreationalContext<?> cc)
+    {
+        if (CreationalContextImpl.class.isInstance(cc))
+        {
+            final InjectionPoint ip = CreationalContextImpl.class.cast(cc).getInjectionPoint();
+            if (ip == null)
+            {
+                return false;
+            }
+
+            final Member member = ip.getMember();
+            if (member != null
+                    && Field.class.isInstance(member) && Field.class.cast(member).getAnnotation(Delegate.class)
!= null)
+            {
+                return true;
+            }
+        }
+        return false;
+    }
     
     protected T newInstance(CreationalContextImpl<T> creationalContext)
     {



Mime
View raw message