Skip to content

Conversation

@marcoferrer
Copy link

@marcoferrer marcoferrer commented Nov 6, 2018

This pr addresses #1417

Unit tests still need to be wrapped up


This change is Reviewable

Comment on lines +244 to +254
if(fieldPair.getKey().isMapField() && fieldPair.getValue() instanceof Collection){
JsonObject mapObject = new JsonObject();
@SuppressWarnings("unchecked")
Collection<MapEntry<Object,Object>> entries =
(Collection<MapEntry<Object, Object>>) fieldPair.getValue();
for(MapEntry<Object,Object> entry : entries){
String key = context.serialize(entry.getKey()).getAsString();
mapObject.add(key, context.serialize(entry.getValue()));
}
ret.add(name, mapObject);
}else{
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if(fieldPair.getKey().isMapField() && fieldPair.getValue() instanceof Collection){
JsonObject mapObject = new JsonObject();
@SuppressWarnings("unchecked")
Collection<MapEntry<Object,Object>> entries =
(Collection<MapEntry<Object, Object>>) fieldPair.getValue();
for(MapEntry<Object,Object> entry : entries){
String key = context.serialize(entry.getKey()).getAsString();
mapObject.add(key, context.serialize(entry.getValue()));
}
ret.add(name, mapObject);
}else{
if (fieldPair.getKey().isMapField() && fieldPair.getValue() instanceof Collection) {
JsonObject mapObject = new JsonObject();
@SuppressWarnings("unchecked")
Collection<MapEntry<Object, Object>> entries =
(Collection<MapEntry<Object, Object>>) fieldPair.getValue();
for (MapEntry<Object, Object> entry : entries) {
String key = context.serialize(entry.getKey()).getAsString();
mapObject.add(key, context.serialize(entry.getValue()));
}
ret.add(name, mapObject);
} else {

.create();
}

//TODO
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you have a test which shows that this works as expected?

Note that I am not a Maintainer, and it could happen that even if you change this pull request it might not be merged (in the near future).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants