cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dk...@apache.org
Subject [7/7] git commit: Handle the case of Arrays and how they are mapped.
Date Thu, 27 Mar 2014 13:07:59 GMT
Handle the case of Arrays and how they are mapped.


Project: http://git-wip-us.apache.org/repos/asf/cxf/repo
Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/e97f8b2e
Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/e97f8b2e
Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/e97f8b2e

Branch: refs/heads/master
Commit: e97f8b2ebfbf3e0fe6a6a8e975f1aacf15e36b22
Parents: 589cfb1
Author: Daniel Kulp <dkulp@apache.org>
Authored: Thu Mar 27 01:14:14 2014 -0400
Committer: Daniel Kulp <dkulp@apache.org>
Committed: Thu Mar 27 09:07:49 2014 -0400

----------------------------------------------------------------------
 .../cxf/common/jaxb/SchemaCollectionContextProxy.java   | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cxf/blob/e97f8b2e/core/src/main/java/org/apache/cxf/common/jaxb/SchemaCollectionContextProxy.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/cxf/common/jaxb/SchemaCollectionContextProxy.java
b/core/src/main/java/org/apache/cxf/common/jaxb/SchemaCollectionContextProxy.java
index b150fd0..c5e7d65 100644
--- a/core/src/main/java/org/apache/cxf/common/jaxb/SchemaCollectionContextProxy.java
+++ b/core/src/main/java/org/apache/cxf/common/jaxb/SchemaCollectionContextProxy.java
@@ -125,6 +125,12 @@ public class SchemaCollectionContextProxy implements JAXBContextProxy
{
     }
 
     public Object getBeanInfo(Class<?> cls) {
+        Class<?> origCls = cls;
+        String postfix = "";
+        while (cls.isArray()) {
+            cls = cls.getComponentType();
+            postfix += "Array";
+        }
         XmlRootElement xre = cls.getAnnotation(XmlRootElement.class);
         String name = xre == null ? "##default" : xre.name();
         String namespace = xre == null ? "##default" : xre.namespace();
@@ -143,20 +149,20 @@ public class SchemaCollectionContextProxy implements JAXBContextProxy
{
                 namespace = defaultNamespace;
             }
         }
-        final QName qname = new QName(namespace, name);
+        final QName qname = new QName(namespace, name + postfix);
         final XmlSchemaElement el = schemas.getElementByQName(qname);
         XmlSchemaType type = null;
         if (el != null) {
             type = el.getSchemaType();
         }
         if (type == null) {
-            type = schemas.getTypeByQName(getTypeQName(cls, namespace));
+            type = schemas.getTypeByQName(getTypeQName(origCls, namespace));
             if (type == null) {
                 type = schemas.getTypeByQName(qname);
             }
         }
         if (type == null) {
-            type = mapToSchemaType(cls, namespace);
+            type = mapToSchemaType(origCls, namespace);
             /*
             if (type == null) {
                 type = mapToSchemaType(cls, namespace);


Mime
View raw message