geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From djen...@apache.org
Subject svn commit: r159456 - geronimo/trunk/modules/axis-builder/src/java/org/apache/geronimo/axis/builder/TypeDescBuilder.java
Date Wed, 30 Mar 2005 01:03:35 GMT
Author: djencks
Date: Tue Mar 29 17:03:34 2005
New Revision: 159456

URL: http://svn.apache.org/viewcvs?view=rev&rev=159456
Log:
map to public fields as well as javabean properties

Modified:
    geronimo/trunk/modules/axis-builder/src/java/org/apache/geronimo/axis/builder/TypeDescBuilder.java

Modified: geronimo/trunk/modules/axis-builder/src/java/org/apache/geronimo/axis/builder/TypeDescBuilder.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/axis-builder/src/java/org/apache/geronimo/axis/builder/TypeDescBuilder.java?view=diff&r1=159455&r2=159456
==============================================================================
--- geronimo/trunk/modules/axis-builder/src/java/org/apache/geronimo/axis/builder/TypeDescBuilder.java
(original)
+++ geronimo/trunk/modules/axis-builder/src/java/org/apache/geronimo/axis/builder/TypeDescBuilder.java
Tue Mar 29 17:03:34 2005
@@ -21,6 +21,7 @@
 import java.beans.IntrospectionException;
 import java.util.Map;
 import java.util.HashMap;
+import java.lang.reflect.Field;
 import javax.xml.namespace.QName;
 
 import org.apache.axis.description.TypeDesc;
@@ -77,10 +78,17 @@
                 ElementDesc elementDesc = new ElementDesc();
                 elementDesc.setFieldName(fieldName);
                 Class javaType = (Class) properties.get(fieldName);
-                if (javaType == null) {
-                    throw new DeploymentException("field name " + fieldName + " not found
in " + properties);
+                if (javaType != null) {
+                    elementDesc.setJavaType(javaType);
+                } else {
+                    //see if it is a public field
+                    try {
+                        Field field = javaClass.getField(fieldName);
+                        elementDesc.setJavaType(field.getType());
+                    } catch (NoSuchFieldException e) {
+                        throw new DeploymentException("field name " + fieldName + " not found
in " + properties);
+                    }
                 }
-                elementDesc.setJavaType(javaType);
                 //TODO correct namespace???
                 String namespace = "";
                 QName xmlName = new QName(namespace, variableMapping.getXmlElementName().getStringValue().trim());
@@ -88,10 +96,10 @@
                 QName xmlType = schemaType.getName();
                 elementDesc.setXmlType(xmlType);
                 //TODO figure out how to find these:
-//                elementDesc.setArrayType(null);
-//                elementDesc.setMinOccurs(0);
-//                elementDesc.setMaxOccurs(0);
-//                elementDesc.setNillable(false);
+//                    elementDesc.setArrayType(null);
+//                    elementDesc.setMinOccurs(0);
+//                    elementDesc.setMaxOccurs(0);
+//                    elementDesc.setNillable(false);
                 fields[i] = elementDesc;
             }
         }



Mime
View raw message