Fixed corner case

This commit is contained in:
Luca Frosini 2021-02-11 17:37:42 +01:00
parent fec18df298
commit d23ca0e246
1 changed files with 4 additions and 7 deletions

View File

@ -263,19 +263,16 @@ public abstract class ElementMapper {
throw new RuntimeException(stringBuffer.toString());
}
protected static JsonNode analizeFullJson(JsonNode jsonNode) {
String cls = jsonNode.get(Element.CLASS_PROPERTY).asText();
if(!knownTypes.containsKey(cls)) {
jsonNode = setAvailableSuperclass(jsonNode);
}
Iterator<String> iterator = jsonNode.fieldNames();
while(iterator.hasNext()) {
String fieldName = iterator.next();
JsonNode jn = jsonNode.get(fieldName);
if(jn.getNodeType() == JsonNodeType.OBJECT) {
if(jn.has(Element.CLASS_PROPERTY)) {
String cls = jn.get(Element.CLASS_PROPERTY).asText();
if(!knownTypes.containsKey(cls)) {
jn = setAvailableSuperclass(jn);
}
}
jn = analizeFullJson(jn);
((ObjectNode) jsonNode).set(fieldName, jn);
}