openwebbeans-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gerdo...@apache.org
Subject svn commit: r735159 - in /incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans: component/xml/XMLComponentImpl.java util/ClassUtil.java xml/WebBeansXMLConfigurator.java xml/XMLDefinitionUtil.java
Date Fri, 16 Jan 2009 22:18:50 GMT
Author: gerdogdu
Date: Fri Jan 16 14:18:50 2009
New Revision: 735159

URL: http://svn.apache.org/viewvc?rev=735159&view=rev
Log:
XML beans corrections.

Modified:
    incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/xml/XMLComponentImpl.java
    incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/ClassUtil.java
    incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/xml/WebBeansXMLConfigurator.java
    incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/xml/XMLDefinitionUtil.java

Modified: incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/xml/XMLComponentImpl.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/xml/XMLComponentImpl.java?rev=735159&r1=735158&r2=735159&view=diff
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/xml/XMLComponentImpl.java
(original)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/xml/XMLComponentImpl.java
Fri Jan 16 14:18:50 2009
@@ -194,7 +194,6 @@
     public void addMethodInjectionPoint(Method method, XMLInjectionPointModel model)
     {
         Asserts.assertNotNull(method, "method parameter can not be null");
-        Asserts.assertNotNull(model, "model parameter can not be null");
 
         List<XMLInjectionPointModel> listModel = this.injectableMethods.get(method);
         if (listModel == null)
@@ -202,8 +201,11 @@
             listModel = new ArrayList<XMLInjectionPointModel>();
             this.injectableMethods.put(method, listModel);
         }
-
-        listModel.add(model);
+        
+        if(model != null)
+        {
+            listModel.add(model);   
+        }
     }
 
     /**

Modified: incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/ClassUtil.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/ClassUtil.java?rev=735159&r1=735158&r2=735159&view=diff
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/ClassUtil.java
(original)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/ClassUtil.java
Fri Jan 16 14:18:50 2009
@@ -788,32 +788,45 @@
         int j = 0;
         for (Method method : methods)
         {
-            Class<?>[] defineTypes = method.getParameterTypes();
-
-            if (defineTypes.length != parameterTypes.size())
+            if(method.getName().equals(methodName))
             {
-                continue;
-            }
+                Class<?>[] defineTypes = method.getParameterTypes();
 
-            boolean ok = false;
-            for (Class<?> defineType : defineTypes)
-            {
-                if (defineType.isAssignableFrom(parameterTypes.get(j)))
+                if (defineTypes.length != parameterTypes.size())
                 {
-                    ok = true;
+                    continue;
                 }
-                else
+
+                boolean ok = true;
+                
+                if(parameterTypes != null && parameterTypes.size() > 0)
                 {
                     ok = false;
                 }
+                
+                if(!ok)
+                {
+                    for (Class<?> defineType : defineTypes)
+                    {
+                        if (defineType.isAssignableFrom(parameterTypes.get(j)))
+                        {
+                            ok = true;
+                        }
+                        else
+                        {
+                            ok = false;
+                        }
 
-                j++;
-            }
-
-            if (ok)
-            {
-                methodList.add(method);
+                        j++;
+                    }                    
+                }
+                
+                if (ok)
+                {
+                    methodList.add(method);
+                }                
             }
+            
         }
 
         return methodList;

Modified: incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/xml/WebBeansXMLConfigurator.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/xml/WebBeansXMLConfigurator.java?rev=735159&r1=735158&r2=735159&view=diff
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/xml/WebBeansXMLConfigurator.java
(original)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/xml/WebBeansXMLConfigurator.java
Fri Jan 16 14:18:50 2009
@@ -784,6 +784,8 @@
      */
     public <T> void configureProducerTypeLevelMetaData(AbstractComponent<T> component,
List<Class<? extends Annotation>> annotationSet, List<Element> annotationElementList,
Element webBeanDecleration)
     {
+        configureBindingType(component, annotationSet, annotationElementList);
+        
         // StereoType
         configureStereoType(component, annotationSet, annotationElementList);
 
@@ -1183,10 +1185,17 @@
      */
     private <T> void configureMethodInitializeAnnotation(XMLComponentImpl<T>
component, Method initializeMethod, List<Element> methodParameterElements)
     {
-        for (Element element : methodParameterElements)
+        if(methodParameterElements.isEmpty())
         {
-            XMLInjectionPointModel model = XMLUtil.getInjectionPointModel(element, createConfigurationFailedMessage());
-            component.addMethodInjectionPoint(initializeMethod, model);
+            component.addMethodInjectionPoint(initializeMethod, null);
+        }
+        else
+        {
+            for (Element element : methodParameterElements)
+            {
+                XMLInjectionPointModel model = XMLUtil.getInjectionPointModel(element, createConfigurationFailedMessage());
+                component.addMethodInjectionPoint(initializeMethod, model);
+            }            
         }
     }
 
@@ -1349,7 +1358,7 @@
      * @param component web beans xml component
      * @param anns annotations defined in the xml documents
      */
-    private <T> void configureBindingType(XMLComponentImpl<T> component, List<Class<?
extends Annotation>> annotationSet, List<Element> annotationElementList)
+    private <T> void configureBindingType(AbstractComponent<T> component, List<Class<?
extends Annotation>> annotationSet, List<Element> annotationElementList)
     {
         boolean isDefined = XMLDefinitionUtil.defineXMLBindingType(component, annotationSet,
annotationElementList, createConfigurationFailedMessage());
 

Modified: incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/xml/XMLDefinitionUtil.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/xml/XMLDefinitionUtil.java?rev=735159&r1=735158&r2=735159&view=diff
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/xml/XMLDefinitionUtil.java
(original)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/xml/XMLDefinitionUtil.java
Fri Jan 16 14:18:50 2009
@@ -172,7 +172,7 @@
         return metaType;
     }
 
-    public static <T> boolean defineXMLBindingType(XMLComponentImpl<T> component,
List<Class<? extends Annotation>> annotationSet, List<Element> annotationElementList,
String errorMessage)
+    public static <T> boolean defineXMLBindingType(AbstractComponent<T> component,
List<Class<? extends Annotation>> annotationSet, List<Element> annotationElementList,
String errorMessage)
     {
         Iterator<Class<? extends Annotation>> it = annotationSet.iterator();
         boolean found = false;
@@ -556,7 +556,7 @@
         else
         {
             /* Configures the java api types and actual type parameters */
-            XMLInjectionPointModel model = XMLUtil.getArrayInjectionPointModel(typeElement,
errorMessage);
+            XMLInjectionPointModel model = XMLUtil.getInjectionPointModel(typeElement, errorMessage);
 
             producerComponentImpl.setActualTypeArguments(model.getActualTypeArguments());
             producerComponentImpl.addApiType(model.getInjectionClassType());



Mime
View raw message