Repository: incubator-juneau
Updated Branches:
  refs/heads/master 1321591d3 -> abdb11388


Bug fixes.  Remove X^ array support (not consistent with JSON support).

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

Branch: refs/heads/master
Commit: abdb1138836f2e5e83bb792c0158f3e57ec6120d
Parents: 1321591
Author: JamesBognar <[email protected]>
Authored: Mon Apr 3 11:57:51 2017 -0400
Committer: JamesBognar <[email protected]>
Committed: Mon Apr 3 11:57:51 2017 -0400

----------------------------------------------------------------------
 .../transforms/BeanDictionaryComboTest.java     | 16 +++----
 .../org/apache/juneau/xml/BasicXmlTest.java     | 48 ++++++++++----------
 .../main/java/org/apache/juneau/ClassMeta.java  | 37 +++------------
 .../org/apache/juneau/xml/XmlSerializer.java    |  8 ++--
 4 files changed, 42 insertions(+), 67 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/abdb1138/juneau-core-test/src/test/java/org/apache/juneau/transforms/BeanDictionaryComboTest.java
----------------------------------------------------------------------
diff --git 
a/juneau-core-test/src/test/java/org/apache/juneau/transforms/BeanDictionaryComboTest.java
 
b/juneau-core-test/src/test/java/org/apache/juneau/transforms/BeanDictionaryComboTest.java
index 5ccd899..5ff7f62 100644
--- 
a/juneau-core-test/src/test/java/org/apache/juneau/transforms/BeanDictionaryComboTest.java
+++ 
b/juneau-core-test/src/test/java/org/apache/juneau/transforms/BeanDictionaryComboTest.java
@@ -62,10 +62,10 @@ public class BeanDictionaryComboTest extends ComboTest {
                                /* Json */              "[{_type:'A',a:1}]",
                                /* JsonT */             "[{t:'A',a:1}]",
                                /* JsonR */             "[\n\t{\n\t\t_type: 
'A',\n\t\ta: 1\n\t}\n]",
-                               /* Xml */               "<array 
_type='A^'><A><a>1</a></A></array>",
-                               /* XmlT */              "<array 
t='A^'><A><a>1</a></A></array>",
-                               /* XmlR */              "<array 
_type='A^'>\n\t<A>\n\t\t<a>1</a>\n\t</A>\n</array>\n",
-                               /* XmlNs */             "<array 
_type='A^'><A><a>1</a></A></array>",
+                               /* Xml */               
"<array><A><a>1</a></A></array>",
+                               /* XmlT */              
"<array><A><a>1</a></A></array>",
+                               /* XmlR */              
"<array>\n\t<A>\n\t\t<a>1</a>\n\t</A>\n</array>\n",
+                               /* XmlNs */             
"<array><A><a>1</a></A></array>",
                                /* Html */              "<table 
_type='array'><tr><th>a</th></tr><tr _type='A'><td>1</td></tr></table>",
                                /* HtmlT */             "<table 
t='array'><tr><th>a</th></tr><tr t='A'><td>1</td></tr></table>",
                                /* HtmlR */             "<table 
_type='array'>\n\t<tr>\n\t\t<th>a</th>\n\t</tr>\n\t<tr 
_type='A'>\n\t\t<td>1</td>\n\t</tr>\n</table>\n",
@@ -137,10 +137,10 @@ public class BeanDictionaryComboTest extends ComboTest {
                                /* Json */              "[{z:'B',b:1}]",
                                /* JsonT */             "[{z:'B',b:1}]",
                                /* JsonR */             "[\n\t{\n\t\tz: 
'B',\n\t\tb: 1\n\t}\n]",
-                               /* Xml */               "<array 
_type='B^'><B><b>1</b></B></array>",
-                               /* XmlT */              "<array 
t='B^'><B><b>1</b></B></array>",
-                               /* XmlR */              "<array 
_type='B^'>\n\t<B>\n\t\t<b>1</b>\n\t</B>\n</array>\n",
-                               /* XmlNs */             "<array 
_type='B^'><B><b>1</b></B></array>",
+                               /* Xml */               
"<array><B><b>1</b></B></array>",
+                               /* XmlT */              
"<array><B><b>1</b></B></array>",
+                               /* XmlR */              
"<array>\n\t<B>\n\t\t<b>1</b>\n\t</B>\n</array>\n",
+                               /* XmlNs */             
"<array><B><b>1</b></B></array>",
                                /* Html */              "<table 
_type='array'><tr><th>b</th></tr><tr z='B'><td>1</td></tr></table>",
                                /* HtmlT */             "<table 
t='array'><tr><th>b</th></tr><tr z='B'><td>1</td></tr></table>",
                                /* HtmlR */             "<table 
_type='array'>\n\t<tr>\n\t\t<th>b</th>\n\t</tr>\n\t<tr 
z='B'>\n\t\t<td>1</td>\n\t</tr>\n</table>\n",

http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/abdb1138/juneau-core-test/src/test/java/org/apache/juneau/xml/BasicXmlTest.java
----------------------------------------------------------------------
diff --git 
a/juneau-core-test/src/test/java/org/apache/juneau/xml/BasicXmlTest.java 
b/juneau-core-test/src/test/java/org/apache/juneau/xml/BasicXmlTest.java
index fab246d..5754274 100644
--- a/juneau-core-test/src/test/java/org/apache/juneau/xml/BasicXmlTest.java
+++ b/juneau-core-test/src/test/java/org/apache/juneau/xml/BasicXmlTest.java
@@ -274,7 +274,7 @@ public class BasicXmlTest {
                                                        +"<b>foo</b>"
                                                +"</B>"
                                        +"</b1>"
-                                       +"<b2 _type='B^'>"
+                                       +"<b2>"
                                                +"<B>"
                                                        +"<b>foo</b>"
                                                +"</B>"
@@ -291,7 +291,7 @@ public class BasicXmlTest {
                                                        +"\t\t\t<b>foo</b>\n"
                                                +"\t\t</B>\n"
                                        +"\t</b1>\n"
-                                       +"\t<b2 _type='B^'>\n"
+                                       +"\t<b2>\n"
                                                +"\t\t<B>\n"
                                                        +"\t\t\t<b>foo</b>\n"
                                                +"\t\t</B>\n"
@@ -308,7 +308,7 @@ public class BasicXmlTest {
                                                        +"<b>foo</b>"
                                                +"</B>"
                                        +"</b1>"
-                                       +"<b2 _type='B^'>"
+                                       +"<b2>"
                                                +"<B>"
                                                        +"<b>foo</b>"
                                                +"</B>"
@@ -331,7 +331,7 @@ public class BasicXmlTest {
                                                        +"</B>"
                                                +"</array>"
                                        +"</b1>"
-                                       +"<b2 _type='B^^'>"
+                                       +"<b2>"
                                                +"<array>"
                                                        +"<B>"
                                                                +"<b>foo</b>"
@@ -354,7 +354,7 @@ public class BasicXmlTest {
                                                        +"\t\t\t</B>\n"
                                                +"\t\t</array>\n"
                                        +"\t</b1>\n"
-                                       +"\t<b2 _type='B^^'>\n"
+                                       +"\t<b2>\n"
                                                +"\t\t<array>\n"
                                                        +"\t\t\t<B>\n"
                                                                
+"\t\t\t\t<b>foo</b>\n"
@@ -377,7 +377,7 @@ public class BasicXmlTest {
                                                        +"</B>"
                                                +"</array>"
                                        +"</b1>"
-                                       +"<b2 _type='B^^'>"
+                                       +"<b2>"
                                                +"<array>"
                                                        +"<B>"
                                                                +"<b>foo</b>"
@@ -637,7 +637,7 @@ public class BasicXmlTest {
                                                        +"<a>foo</a>"
                                                +"</A>"
                                        +"</a>"
-                                       +"<ia1 _type='A^'>"
+                                       +"<ia1>"
                                                +"<A>"
                                                        +"<a>foo</a>"
                                                +"</A>"
@@ -647,7 +647,7 @@ public class BasicXmlTest {
                                                        +"<a>foo</a>"
                                                +"</A>"
                                        +"</ia2>"
-                                       +"<aa1 _type='A^'>"
+                                       +"<aa1>"
                                                +"<A>"
                                                        +"<a>foo</a>"
                                                +"</A>"
@@ -657,7 +657,7 @@ public class BasicXmlTest {
                                                        +"<a>foo</a>"
                                                +"</A>"
                                        +"</aa2>"
-                                       +"<o1 _type='A^'>"
+                                       +"<o1>"
                                                +"<A>"
                                                        +"<a>foo</a>"
                                                +"</A>"
@@ -674,7 +674,7 @@ public class BasicXmlTest {
                                                        +"\t\t\t<a>foo</a>\n"
                                                +"\t\t</A>\n"
                                        +"\t</a>\n"
-                                       +"\t<ia1 _type='A^'>\n"
+                                       +"\t<ia1>\n"
                                                +"\t\t<A>\n"
                                                        +"\t\t\t<a>foo</a>\n"
                                                +"\t\t</A>\n"
@@ -684,7 +684,7 @@ public class BasicXmlTest {
                                                        +"\t\t\t<a>foo</a>\n"
                                                +"\t\t</A>\n"
                                        +"\t</ia2>\n"
-                                       +"\t<aa1 _type='A^'>\n"
+                                       +"\t<aa1>\n"
                                                +"\t\t<A>\n"
                                                        +"\t\t\t<a>foo</a>\n"
                                                +"\t\t</A>\n"
@@ -694,7 +694,7 @@ public class BasicXmlTest {
                                                        +"\t\t\t<a>foo</a>\n"
                                                +"\t\t</A>\n"
                                        +"\t</aa2>\n"
-                                       +"\t<o1 _type='A^'>\n"
+                                       +"\t<o1>\n"
                                                +"\t\t<A>\n"
                                                        +"\t\t\t<a>foo</a>\n"
                                                +"\t\t</A>\n"
@@ -711,7 +711,7 @@ public class BasicXmlTest {
                                                        +"<a>foo</a>"
                                                +"</A>"
                                        +"</a>"
-                                       +"<ia1 _type='A^'>"
+                                       +"<ia1>"
                                                +"<A>"
                                                        +"<a>foo</a>"
                                                +"</A>"
@@ -721,7 +721,7 @@ public class BasicXmlTest {
                                                        +"<a>foo</a>"
                                                +"</A>"
                                        +"</ia2>"
-                                       +"<aa1 _type='A^'>"
+                                       +"<aa1>"
                                                +"<A>"
                                                        +"<a>foo</a>"
                                                +"</A>"
@@ -731,7 +731,7 @@ public class BasicXmlTest {
                                                        +"<a>foo</a>"
                                                +"</A>"
                                        +"</aa2>"
-                                       +"<o1 _type='A^'>"
+                                       +"<o1>"
                                                +"<A>"
                                                        +"<a>foo</a>"
                                                +"</A>"
@@ -810,7 +810,7 @@ public class BasicXmlTest {
                                                +"</a1>"
                                        +"</a>"
                                        +"<ia>"
-                                               +"<ia1 _type='A^'>"
+                                               +"<ia1>"
                                                        +"<A>"
                                                                +"<a>foo</a>"
                                                        +"</A>"
@@ -822,7 +822,7 @@ public class BasicXmlTest {
                                                +"</ia2>"
                                        +"</ia>"
                                        +"<aa>"
-                                               +"<aa1 _type='A^'>"
+                                               +"<aa1>"
                                                        +"<A>"
                                                                +"<a>foo</a>"
                                                        +"</A>"
@@ -834,7 +834,7 @@ public class BasicXmlTest {
                                                +"</aa2>"
                                        +"</aa>"
                                        +"<o>"
-                                               +"<o1 _type='A^'>"
+                                               +"<o1>"
                                                        +"<A>"
                                                                +"<a>foo</a>"
                                                        +"</A>"
@@ -855,7 +855,7 @@ public class BasicXmlTest {
                                                +"\t\t</a1>\n"
                                        +"\t</a>\n"
                                        +"\t<ia>\n"
-                                               +"\t\t<ia1 _type='A^'>\n"
+                                               +"\t\t<ia1>\n"
                                                        +"\t\t\t<A>\n"
                                                                
+"\t\t\t\t<a>foo</a>\n"
                                                        +"\t\t\t</A>\n"
@@ -867,7 +867,7 @@ public class BasicXmlTest {
                                                +"\t\t</ia2>\n"
                                        +"\t</ia>\n"
                                        +"\t<aa>\n"
-                                               +"\t\t<aa1 _type='A^'>\n"
+                                               +"\t\t<aa1>\n"
                                                        +"\t\t\t<A>\n"
                                                                
+"\t\t\t\t<a>foo</a>\n"
                                                        +"\t\t\t</A>\n"
@@ -879,7 +879,7 @@ public class BasicXmlTest {
                                                +"\t\t</aa2>\n"
                                        +"\t</aa>\n"
                                        +"\t<o>\n"
-                                               +"\t\t<o1 _type='A^'>\n"
+                                               +"\t\t<o1>\n"
                                                        +"\t\t\t<A>\n"
                                                                
+"\t\t\t\t<a>foo</a>\n"
                                                        +"\t\t\t</A>\n"
@@ -900,7 +900,7 @@ public class BasicXmlTest {
                                                +"</a1>"
                                        +"</a>"
                                        +"<ia>"
-                                               +"<ia1 _type='A^'>"
+                                               +"<ia1>"
                                                        +"<A>"
                                                                +"<a>foo</a>"
                                                        +"</A>"
@@ -912,7 +912,7 @@ public class BasicXmlTest {
                                                +"</ia2>"
                                        +"</ia>"
                                        +"<aa>"
-                                               +"<aa1 _type='A^'>"
+                                               +"<aa1>"
                                                        +"<A>"
                                                                +"<a>foo</a>"
                                                        +"</A>"
@@ -924,7 +924,7 @@ public class BasicXmlTest {
                                                +"</aa2>"
                                        +"</aa>"
                                        +"<o>"
-                                               +"<o1 _type='A^'>"
+                                               +"<o1>"
                                                        +"<A>"
                                                                +"<a>foo</a>"
                                                        +"</A>"

http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/abdb1138/juneau-core/src/main/java/org/apache/juneau/ClassMeta.java
----------------------------------------------------------------------
diff --git a/juneau-core/src/main/java/org/apache/juneau/ClassMeta.java 
b/juneau-core/src/main/java/org/apache/juneau/ClassMeta.java
index 9614408..b0343a4 100644
--- a/juneau-core/src/main/java/org/apache/juneau/ClassMeta.java
+++ b/juneau-core/src/main/java/org/apache/juneau/ClassMeta.java
@@ -102,8 +102,7 @@ public final class ClassMeta<T> implements Type {
        private final String
                typePropertyName,                                    // The 
property name of the _type property for this class and subclasses.
                notABeanReason,                                      // If this 
isn't a bean, the reason why.
-               dictionaryName,                                      // The 
dictionary name of this class if it has one.
-               resolvedDictionaryName;                              // The 
name if this is an array type (e.g. "X^^").
+               dictionaryName;                                      // The 
dictionary name of this class if it has one.
        private final Throwable initException;                  // Any 
exceptions thrown in the init() method.
        private final InvocationHandler invocationHandler;      // The 
invocation handler for this class (if it has one).
        private final BeanRegistry beanRegistry;                // The bean 
registry of this class meta (if it has one).
@@ -174,7 +173,6 @@ public final class ClassMeta<T> implements Type {
                this.initException = builder.initException;
                this.typePropertyName = builder.typePropertyName;
                this.dictionaryName = builder.dictionaryName;
-               this.resolvedDictionaryName = builder.resolvedDictionaryName;
                this.serializedClassMeta = builder.serializedClassMeta;
                this.invocationHandler = builder.invocationHandler;
                this.beanRegistry = builder.beanRegistry;
@@ -225,7 +223,6 @@ public final class ClassMeta<T> implements Type {
                this.beanMeta = mainType.beanMeta;
                this.typePropertyName = mainType.typePropertyName;
                this.dictionaryName = mainType.dictionaryName;
-               this.resolvedDictionaryName = mainType.resolvedDictionaryName;
                this.notABeanReason = mainType.notABeanReason;
                this.pojoSwap = mainType.pojoSwap;
                this.beanFilter = mainType.beanFilter;
@@ -274,7 +271,6 @@ public final class ClassMeta<T> implements Type {
                this.beanMeta = null;
                this.typePropertyName = null;
                this.dictionaryName = null;
-               this.resolvedDictionaryName = null;
                this.notABeanReason = null;
                this.pojoSwap = null;
                this.beanFilter = null;
@@ -320,8 +316,7 @@ public final class ClassMeta<T> implements Type {
                String
                        typePropertyName = null,
                        notABeanReason = null,
-                       dictionaryName = null,
-                       resolvedDictionaryName = null;
+                       dictionaryName = null;
                Throwable initException = null;
                BeanMeta beanMeta = null;
                PojoSwap pojoSwap = null;
@@ -627,11 +622,11 @@ public final class ClassMeta<T> implements Type {
                                        try {
                                                newMeta = new 
BeanMeta(ClassMeta.this, beanContext, beanFilter, null);
                                                notABeanReason = 
newMeta.notABeanReason;
-                                               
+
                                                // Always get these even if 
it's not a bean:
-                                               beanRegistry = 
newMeta.beanRegistry;  
-                                               typePropertyName = 
newMeta.typePropertyName; 
-                                               
+                                               beanRegistry = 
newMeta.beanRegistry;
+                                               typePropertyName = 
newMeta.typePropertyName;
+
                                        } catch (RuntimeException e) {
                                                notABeanReason = e.getMessage();
                                                throw e;
@@ -648,13 +643,7 @@ public final class ClassMeta<T> implements Type {
                        }
 
                        if (beanMeta != null)
-                               dictionaryName = resolvedDictionaryName = 
beanMeta.getDictionaryName();
-
-                       if (cc == ARRAY && elementType != null) {
-                               resolvedDictionaryName = 
elementType.getResolvedDictionaryName();
-                               if (resolvedDictionaryName != null)
-                                       resolvedDictionaryName += "^";
-                       }
+                               dictionaryName = beanMeta.getDictionaryName();
 
                        serializedClassMeta = (this.pojoSwap == null ? 
ClassMeta.this : findClassMeta(this.pojoSwap.getSwapClass()));
                        if (serializedClassMeta == null)
@@ -729,18 +718,6 @@ public final class ClassMeta<T> implements Type {
        }
 
        /**
-        * Returns the resolved bean dictionary name associated with this class.
-        * <p>
-        * Unlike {@link #getDictionaryName()}, this method automatically 
resolves multidimensional arrays
-        * (e.g. <js>"X^^"</js> and returns array class metas accordingly if 
the base class has a type name.
-        *
-        * @return The type name associated with this bean class, or 
<jk>null</jk> if there is no type name defined or this isn't a bean.
-        */
-       public String getResolvedDictionaryName() {
-               return resolvedDictionaryName;
-       }
-
-       /**
         * Returns the bean registry for this class.
         * <p>
         * This bean registry contains names specified in the {@link 
Bean#beanDictionary()} annotation defined

http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/abdb1138/juneau-core/src/main/java/org/apache/juneau/xml/XmlSerializer.java
----------------------------------------------------------------------
diff --git a/juneau-core/src/main/java/org/apache/juneau/xml/XmlSerializer.java 
b/juneau-core/src/main/java/org/apache/juneau/xml/XmlSerializer.java
index 3db721c..ccb8f2a 100644
--- a/juneau-core/src/main/java/org/apache/juneau/xml/XmlSerializer.java
+++ b/juneau-core/src/main/java/org/apache/juneau/xml/XmlSerializer.java
@@ -408,13 +408,13 @@ public class XmlSerializer extends WriterSerializer {
                                isExpectedType = aType.isNumber();
                        else if (eType.isMap())
                                isExpectedType = aType.isMap();
-                       else if (eType.isCollection())
-                               isExpectedType = aType.isCollection();
+                       else if (eType.isCollectionOrArray())
+                               isExpectedType = aType.isCollectionOrArray();
                        else
                                isExpectedType = false;
                }
 
-               String resolvedDictionaryName = isExpectedType ? null : 
aType.getResolvedDictionaryName();
+               String resolvedDictionaryName = isExpectedType ? null : 
aType.getDictionaryName();
 
                // Note that the dictionary name may be specified on the actual 
type or the serialized type.
                // HTML templates will have them defined on the serialized type.
@@ -543,8 +543,6 @@ public class XmlSerializer extends WriterSerializer {
                        } else if (sType.isArray()) {
                                if (isCollapsed)
                                        session.indent--;
-                               if (resolvedDictionaryName != null)
-                                       eType = aType;
                                serializeCollection(session, out, o, sType, 
eType, pMeta, isMixed);
                                if (isCollapsed)
                                        session.indent++;

Reply via email to