juneau-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jamesbog...@apache.org
Subject [juneau] branch master updated: Fix parser bugs involving beans with builders.
Date Sun, 16 Sep 2018 18:31:46 GMT
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 568929f  Fix parser bugs involving beans with builders.
568929f is described below

commit 568929f2fd59c2614878fd38646e58c662b57d74
Author: JamesBognar <jamesbognar@apache.org>
AuthorDate: Sun Sep 16 14:31:31 2018 -0400

    Fix parser bugs involving beans with builders.
---
 .../juneau/a/rttests/RountTripBeansWithBuilders.java   |  2 --
 .../java/org/apache/juneau/html/HtmlParserSession.java | 18 +++++++++++++++---
 2 files changed, 15 insertions(+), 5 deletions(-)

diff --git a/juneau-core/juneau-core-test/src/test/java/org/apache/juneau/a/rttests/RountTripBeansWithBuilders.java
b/juneau-core/juneau-core-test/src/test/java/org/apache/juneau/a/rttests/RountTripBeansWithBuilders.java
index 128a0ee..6368c62 100644
--- a/juneau-core/juneau-core-test/src/test/java/org/apache/juneau/a/rttests/RountTripBeansWithBuilders.java
+++ b/juneau-core/juneau-core-test/src/test/java/org/apache/juneau/a/rttests/RountTripBeansWithBuilders.java
@@ -119,7 +119,6 @@ public class RountTripBeansWithBuilders extends RoundTripTest {
 	//====================================================================================================
 
 	@Test
-	@Ignore
 	public void beanPropertyBuilder_collections() throws Exception {
 		// It's simply not possible to allow for expanded parameters with a builder-based approach
 		// since the value on the builder can only be set once.
@@ -262,5 +261,4 @@ public class RountTripBeansWithBuilders extends RoundTripTest {
 			return f9;
 		}
 	}
-
 }
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/html/HtmlParserSession.java
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/html/HtmlParserSession.java
index 4371e59..df23b53 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/html/HtmlParserSession.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/html/HtmlParserSession.java
@@ -411,8 +411,14 @@ public final class HtmlParserSession extends XmlParserSession {
 			if (elementType == null)
 				elementType = object();
 
-			if (elementType.canCreateNewBean(l)) {
-				BeanMap m = newBeanMap(l, elementType.getInnerClass());
+			BuilderSwap<E,Object> builder = elementType.getBuilderSwap(this);
+
+			if (builder != null || elementType.canCreateNewBean(l)) {
+				BeanMap m =
+					builder != null
+					? toBeanMap(builder.create(this, elementType))
+					: newBeanMap(l, elementType.getInnerClass())
+				;
 				for (int i = 0; i < keys.size(); i++) {
 					tag = nextTag(r, TD, NULL);
 					if (tag == NULL) {
@@ -433,7 +439,13 @@ public final class HtmlParserSession extends XmlParserSession {
 						bpm.set(m, key, value);
 					}
 				}
-				l.add(m == null ? null : (E)m.getBean());
+				l.add(
+					m == null
+					? null
+					: builder != null
+						? builder.build(this, m.getBean(), elementType)
+						: (E)m.getBean()
+				);
 			} else {
 				String c = getAttributes(r).get(getBeanTypePropertyName(type.getElementType()));
 				Map m = (Map)(elementType.isMap() && elementType.canCreateNewInstance(l) ? elementType.newInstance(l)


Mime
View raw message