Improved unmarshalling in ElementMapper
This commit is contained in:
parent
f9137ffff9
commit
1368f707c8
|
@ -312,7 +312,11 @@ public abstract class ElementMapper {
|
|||
}
|
||||
JsonNode jsonNode = mapper.readTree(reader);
|
||||
jsonNode = analizeTypes((ObjectNode) jsonNode);
|
||||
try {
|
||||
return ElementMapper.unmarshal(clz, mapper.writeValueAsString(jsonNode));
|
||||
}catch (Throwable t) {
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -336,7 +340,11 @@ public abstract class ElementMapper {
|
|||
}
|
||||
JsonNode jsonNode = mapper.readTree(stream);
|
||||
jsonNode = analizeTypes((ObjectNode) jsonNode);
|
||||
try {
|
||||
return ElementMapper.unmarshal(clz, mapper.writeValueAsString(jsonNode));
|
||||
}catch (Throwable t) {
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -359,7 +367,11 @@ public abstract class ElementMapper {
|
|||
}
|
||||
JsonNode jsonNode = mapper.readTree(string);
|
||||
jsonNode = analizeTypes((ObjectNode) jsonNode);
|
||||
try {
|
||||
return ElementMapper.unmarshal(clz, mapper.writeValueAsString(jsonNode));
|
||||
}catch (Throwable t) {
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -374,10 +386,14 @@ public abstract class ElementMapper {
|
|||
}
|
||||
List<El> ret = new ArrayList<>();
|
||||
ArrayNode arrayNode = (ArrayNode) mapper.readTree(string);
|
||||
try {
|
||||
for(JsonNode jsonNode : arrayNode) {
|
||||
jsonNode = analizeTypes((ObjectNode) jsonNode);
|
||||
ret.add(ElementMapper.unmarshal(clz, mapper.writeValueAsString(jsonNode)));
|
||||
}
|
||||
}catch (Throwable t) {
|
||||
throw e;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
|
@ -390,10 +406,14 @@ public abstract class ElementMapper {
|
|||
} catch (InvalidTypeIdException e) {
|
||||
List<El> ret = new ArrayList<>();
|
||||
ArrayNode arrayNode = (ArrayNode) mapper.readTree(string);
|
||||
try {
|
||||
for(JsonNode jsonNode : arrayNode) {
|
||||
jsonNode = analizeTypes((ObjectNode) jsonNode);
|
||||
ret.add((El) ElementMapper.unmarshal(Element.class, mapper.writeValueAsString(jsonNode)));
|
||||
}
|
||||
}catch (Throwable t) {
|
||||
throw e;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue