You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openwebbeans.apache.org by ge...@apache.org on 2008/12/22 00:54:32 UTC

svn commit: r728556 - in /incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/xml: XMLDefinitionUtil.java XMLUtil.java

Author: gerdogdu
Date: Sun Dec 21 15:54:32 2008
New Revision: 728556

URL: http://svn.apache.org/viewvc?rev=728556&view=rev
Log:
Annotation generation is updated.

Modified:
    incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/xml/XMLDefinitionUtil.java
    incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/xml/XMLUtil.java

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=728556&r1=728555&r2=728556&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 Sun Dec 21 15:54:32 2008
@@ -216,10 +216,10 @@
 					found = true;
 				}
 				
-				i++;
-				
 				component.addBindingType(XMLUtil.getXMLDefinedAnnotationMember(annotationElementList.get(i), temp, errorMessage));
 			}
+			
+			i++;
 		}
 		
 		return found;

Modified: incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/xml/XMLUtil.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/xml/XMLUtil.java?rev=728556&r1=728555&r2=728556&view=diff
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/xml/XMLUtil.java (original)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/xml/XMLUtil.java Sun Dec 21 15:54:32 2008
@@ -723,7 +723,7 @@
 		 Method[] members = annotClazz.getDeclaredMethods();
 		 for(Method member : members)
 		 {
-			 if(member.getDefaultValue() == null)
+			 if(member.getDefaultValue() == null && value == null)
 			 {
 				 if(!attrsNames.contains(member.getName()))
 				 {
@@ -733,7 +733,7 @@
 		 }
 		 
 		
-		return createInjectionPointAnnotation(attrs, annotClazz, errorMessage);
+		return createInjectionPointAnnotation(attrs, annotClazz, value, errorMessage);
 	}
 	
 	/**
@@ -745,13 +745,23 @@
 	 * 
 	 * @return new annotation
 	 */
-	private static WebBeansAnnotation createInjectionPointAnnotation(List<Attribute> attrs, Class<? extends Annotation> annotClazz, String errorMessage)
+	private static WebBeansAnnotation createInjectionPointAnnotation(List<Attribute> attrs, Class<? extends Annotation> annotClazz, String valueText, String errorMessage)
 	{
 		 WebBeansAnnotation annotation = JavassistProxyFactory.createNewAnnotationProxy(annotClazz);
+		 boolean isValueAttrDefined = false;
 		 for(Attribute attr : attrs)
 		 {
 			 String attrName = attr.getName();
 			 String attrValue = attr.getValue();
+			 
+			 if(!isValueAttrDefined)
+			 {
+				 if(attrName.equals("value"))
+				 {
+					 isValueAttrDefined = true;
+				 } 
+			 }		
+			 
 			 Class returnType = null;
 			 try
 				{
@@ -795,6 +805,14 @@
 					throw new WebBeansConfigurationException(errorMessage + "Annotation with type : " + annotClazz.getName() + " does not have member with name : " + attrName);
 				}
 		 }
+		 
+		 if(!isValueAttrDefined)
+		 {
+			 if(valueText != null && !valueText.equals(""))
+			 {
+				 annotation.setMemberValue("value", valueText);
+			 }
+		 }
 		
 		 return annotation;
 	}