#1839 - Fix JSON marshalling of @ElementCollection maps and scalar

This commit is contained in:
rob bygrave committed 2019-10-10 21:32:44 +13:00
1 parent 20dd33ebca
commit 8890079b80
17 files changed
+206 -45

No files matched your search

@@ -971,7 +971,11 @@ public class BeanPropertyAssocMany<T> extends BeanPropertyAssoc<T> implements ST
}
void jsonWriteMapEntry(SpiJsonWriter ctx, Map.Entry<?, ?> entry) throws IOException {
elementDescriptor.jsonWriteMapEntry(ctx, entry);
if (elementDescriptor != null) {
elementDescriptor.jsonWriteMapEntry(ctx, entry);
} else {
targetDescriptor.jsonWrite(ctx, (EntityBean)entry.getValue());
}
}
void jsonWriteElementValue(SpiJsonWriter ctx, Object element) {
@@ -1051,10 +1055,9 @@ public class BeanPropertyAssocMany<T> extends BeanPropertyAssoc<T> implements ST
*/
public Object jsonReadCollection(SpiJsonReader readJson, EntityBean parentBean) throws IOException {
if (elementDescriptor != null && manyType.isMap()) {
if (elementDescriptor != null && elementDescriptor.isJsonReadCollection()) {
return elementDescriptor.jsonReadCollection(readJson, parentBean);
}
BeanCollection<?> collection = createEmpty(parentBean);
BeanCollectionAdd add = getBeanCollectionAdd(collection);
do {