You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by na...@apache.org on 2008/05/03 05:49:40 UTC

svn commit: r652990 - /webservices/axis2/trunk/java/modules/adb/src/org/apache/axis2/databinding/utils/BeanUtil.java

Author: nadiramra
Date: Fri May  2 20:49:40 2008
New Revision: 652990

URL: http://svn.apache.org/viewvc?rev=652990&view=rev
Log:
AXIS2-3651 BeanUtil class should try and fill the xsi:type attribute with value from type table before defaulting to class name

Modified:
    webservices/axis2/trunk/java/modules/adb/src/org/apache/axis2/databinding/utils/BeanUtil.java

Modified: webservices/axis2/trunk/java/modules/adb/src/org/apache/axis2/databinding/utils/BeanUtil.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/adb/src/org/apache/axis2/databinding/utils/BeanUtil.java?rev=652990&r1=652989&r2=652990&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/adb/src/org/apache/axis2/databinding/utils/BeanUtil.java (original)
+++ webservices/axis2/trunk/java/modules/adb/src/org/apache/axis2/databinding/utils/BeanUtil.java Fri May  2 20:49:40 2008
@@ -248,13 +248,28 @@
                     object.add(value);
                 }
             }
-            // Added objectAttributes as a fix for issues AXIS2-2055 and AXIS2-1899 to
-            // support polymorphism in POJO approach.
-            // For some reason, using QName(Constants.XSI_NAMESPACE, "type", "xsi") does not generate
-            // an xsi:type attribtue properly for inner objects. So just using a simple QName("type").
+
             ArrayList objectAttributes = new ArrayList();
-            objectAttributes.add(new QName("type"));
-            objectAttributes.add(beanObject.getClass().getName());
+            objectAttributes.add(new QName(Constants.XSI_NAMESPACE, "type", "xsi"));
+            if( typeTable != null && qualified )
+            {
+                QName qNamefortheType =
+                    typeTable.getQNamefortheType(beanObject.getClass().getName());
+                if (qNamefortheType == null) {
+                    // Added objectAttributes as a fix for issues AXIS2-2055 and AXIS2-1899 to
+                    // support polymorphism in POJO approach.
+                    objectAttributes.add(beanObject.getClass().getName());
+                }
+                else
+                {
+                    objectAttributes.add(qNamefortheType);
+                }
+            }
+            else
+            {
+                objectAttributes.add(beanObject.getClass().getName());
+            } 
+
             return new ADBXMLStreamReaderImpl(beanName, object.toArray(), objectAttributes.toArray(),
                     typeTable, qualified);
 



---------------------------------------------------------------------
To unsubscribe, e-mail: axis-cvs-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-cvs-help@ws.apache.org