You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@juneau.apache.org by ja...@apache.org on 2019/07/09 18:37:47 UTC

[juneau] branch master updated: JUNEAU-126 Serializers should serialize Iterators and Enumerations by default.

This is an automated email from the ASF dual-hosted git repository.

jamesbognar pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/juneau.git


The following commit(s) were added to refs/heads/master by this push:
     new dd11a10  JUNEAU-126 Serializers should serialize Iterators and Enumerations by default.
dd11a10 is described below

commit dd11a10f57c84bbe821952a24d57746c4afb8039
Author: JamesBognar <ja...@apache.org>
AuthorDate: Tue Jul 9 14:37:33 2019 -0400

    JUNEAU-126 Serializers should serialize Iterators and Enumerations by
    default.
---
 .../juneau-marshall/src/main/java/org/apache/juneau/ClassMeta.java   | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/ClassMeta.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/ClassMeta.java
index 3dca1f6..63393c9 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/ClassMeta.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/ClassMeta.java
@@ -35,6 +35,7 @@ import org.apache.juneau.parser.*;
 import org.apache.juneau.reflect.*;
 import org.apache.juneau.serializer.*;
 import org.apache.juneau.transform.*;
+import org.apache.juneau.transforms.*;
 import org.apache.juneau.utils.*;
 
 /**
@@ -634,6 +635,10 @@ public final class ClassMeta<T> implements Type {
 				);
 			}
 
+			if (Enumeration.class.isAssignableFrom(c))
+				this.pojoSwaps.add(new EnumerationSwap());
+			else if (Iterator.class.isAssignableFrom(c))
+				this.pojoSwaps.add(new IteratorSwap());
 			if (pojoSwaps != null)
 				this.pojoSwaps.addAll(Arrays.asList(pojoSwaps));