openwebbeans-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rmannibu...@apache.org
Subject svn commit: r1647591 - /openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/creation/ProducerFieldBeansBuilder.java
Date Tue, 23 Dec 2014 15:10:50 GMT
Author: rmannibucau
Date: Tue Dec 23 15:10:50 2014
New Revision: 1647591

URL: http://svn.apache.org/r1647591
Log:
@Produces @EJB, @Resource, @persistenceX,@WebServiceRef...can be static

Modified:
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/creation/ProducerFieldBeansBuilder.java

Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/creation/ProducerFieldBeansBuilder.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/creation/ProducerFieldBeansBuilder.java?rev=1647591&r1=1647590&r2=1647591&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/creation/ProducerFieldBeansBuilder.java
(original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/creation/ProducerFieldBeansBuilder.java
Tue Dec 23 15:10:50 2014
@@ -20,7 +20,6 @@ package org.apache.webbeans.component.cr
 
 import java.lang.annotation.Annotation;
 import java.lang.reflect.Field;
-import java.lang.reflect.Modifier;
 import java.util.HashSet;
 import java.util.Set;
 
@@ -84,28 +83,25 @@ public class ProducerFieldBeansBuilder<T
                 {                    
                     //Check for valid resource annotation
                     //WebBeansUtil.checkForValidResources(annotatedField.getDeclaringType().getJavaClass(),
field.getType(), field.getName(), anns);
-                    if(!Modifier.isStatic(field.getModifiers()))
+                    ResourceReference<T, Annotation> resourceRef = new ResourceReference<T,
Annotation>(annotatedType.getJavaClass(), field.getName(),
+                                                                                        
               (Class<T>)field.getType(), resourceAnnotation);
+
+                    //Can not define EL name
+                    if(annotatedField.isAnnotationPresent(Named.class))
+                    {
+                        throw new WebBeansConfigurationException("Resource producer annotated
field : " + annotatedField + " can not define EL name");
+                    }
+
+                    final BeanAttributes<T> beanAttributes = webBeansContext.getWebBeansUtil().fireProcessBeanAttributes(
+                            annotatedType, annotatedField.getJavaMember().getType(),
+                            BeanAttributesBuilder.forContext(webBeansContext).newBeanAttibutes((AnnotatedField<T>)annotatedField).build());
+                    if (beanAttributes != null)
                     {
-                        ResourceReference<T, Annotation> resourceRef = new ResourceReference<T,
Annotation>(annotatedType.getJavaClass(), field.getName(),
-                                                                                        
                   (Class<T>)field.getType(), resourceAnnotation);
-                        
-                        //Can not define EL name
-                        if(annotatedField.isAnnotationPresent(Named.class))
-                        {
-                            throw new WebBeansConfigurationException("Resource producer annotated
field : " + annotatedField + " can not define EL name");
-                        }
-
-                        final BeanAttributes<T> beanAttributes = webBeansContext.getWebBeansUtil().fireProcessBeanAttributes(
-                                annotatedType, annotatedField.getJavaMember().getType(),
-                                BeanAttributesBuilder.forContext(webBeansContext).newBeanAttibutes((AnnotatedField<T>)annotatedField).build());
-                        if (beanAttributes != null)
-                        {
-                            ResourceBeanBuilder<T, Annotation> resourceBeanCreator
-                                    = new ResourceBeanBuilder<T, Annotation>(bean,
resourceRef, annotatedField, beanAttributes);
-                            ResourceBean<T, Annotation> resourceBean = resourceBeanCreator.getBean();
-                            resourceBean.setProducerField(field);
-                            producerBeans.add(resourceBean);
-                        }
+                        ResourceBeanBuilder<T, Annotation> resourceBeanCreator
+                                = new ResourceBeanBuilder<T, Annotation>(bean, resourceRef,
annotatedField, beanAttributes);
+                        ResourceBean<T, Annotation> resourceBean = resourceBeanCreator.getBean();
+                        resourceBean.setProducerField(field);
+                        producerBeans.add(resourceBean);
                     }
                 }
                 else



Mime
View raw message