geronimo-xbean-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gno...@apache.org
Subject svn commit: r512926 - /geronimo/xbean/trunk/xbean-spring-common/src/main/java/org/apache/xbean/spring/generator/QdoxMappingLoader.java
Date Wed, 28 Feb 2007 19:39:53 GMT
Author: gnodet
Date: Wed Feb 28 11:39:53 2007
New Revision: 512926

URL: http://svn.apache.org/viewvc?view=rev&rev=512926
Log:
Add a "factoryClass" property to the @XBean tag to specify the atual class build by spring
factories

Modified:
    geronimo/xbean/trunk/xbean-spring-common/src/main/java/org/apache/xbean/spring/generator/QdoxMappingLoader.java

Modified: geronimo/xbean/trunk/xbean-spring-common/src/main/java/org/apache/xbean/spring/generator/QdoxMappingLoader.java
URL: http://svn.apache.org/viewvc/geronimo/xbean/trunk/xbean-spring-common/src/main/java/org/apache/xbean/spring/generator/QdoxMappingLoader.java?view=diff&rev=512926&r1=512925&r2=512926
==============================================================================
--- geronimo/xbean/trunk/xbean-spring-common/src/main/java/org/apache/xbean/spring/generator/QdoxMappingLoader.java
(original)
+++ geronimo/xbean/trunk/xbean-spring-common/src/main/java/org/apache/xbean/spring/generator/QdoxMappingLoader.java
Wed Feb 28 11:39:53 2007
@@ -150,7 +150,7 @@
         		JavaClass[] classes = javaSources[i].getClasses();
         		for (int j = 0; j < classes.length; j++) {
     	            JavaClass javaClass = classes[j];    	        	
-    	            ElementMapping element = loadElement(javaClass);
+    	            ElementMapping element = loadElement(builder, javaClass);
     	            if (element != null && !javaClass.isAbstract()) {
     	                elements.add(element);
     	            } else {
@@ -162,7 +162,7 @@
         return elements;
     }
 
-    private ElementMapping loadElement(JavaClass javaClass) {
+    private ElementMapping loadElement(JavaDocBuilder builder, JavaClass javaClass) {
         DocletTag xbeanTag = javaClass.getTagByName(XBEAN_ANNOTATION);
         if (xbeanTag == null) {
             return null;
@@ -177,6 +177,10 @@
         String namespace = getProperty(xbeanTag, "namespace", defaultNamespace);
         boolean root = getBooleanProperty(xbeanTag, "rootElement");
         String contentProperty = getProperty(xbeanTag, "contentProperty");
+        String factoryClass = getProperty(xbeanTag, "factoryClass");
+        if (factoryClass != null) {
+            System.out.println("FactoryClass: " + factoryClass);
+        }
 
         Map mapsByPropertyName = new HashMap();
         List flatProperties = new ArrayList();
@@ -271,8 +275,22 @@
 
         System.out.println("Checking: "+javaClass.getFullyQualifiedName());
 
+        JavaClass actualClass = javaClass;
+        if (factoryClass != null) {
+            JavaClass clazz = builder.getClassByName(factoryClass);
+            if (clazz != null) {
+                log.info("Detected factory: using " + factoryClass + " instead of " + javaClass.getFullyQualifiedName());
+                actualClass = clazz;
+            } else {
+                log.info("Could not load class built by factory: " + factoryClass);
+            }
+        }
+        
         ArrayList superClasses = new ArrayList();
-        JavaClass p = javaClass;
+        JavaClass p = actualClass;
+        if (actualClass != javaClass) {
+            superClasses.add(actualClass.getFullyQualifiedName());
+        }
         while( true ) {
             JavaClass s = p.getSuperJavaClass();
             if( s==null || s.equals(p) || "java.lang.Object".equals(s.getFullyQualifiedName())
) {



Mime
View raw message