Add method to support retrieving objects as strings

pull/12/head
Hammy 3 years ago
parent cd5d40193d
commit a640781deb

@ -22,6 +22,14 @@ class APIMapper {
objectMapper = new ObjectMapper(); objectMapper = new ObjectMapper();
} }
String getValueAsString(Object obj) throws APIMapperException {
try {
return objectMapper.writeValueAsString(obj);
} catch (JsonProcessingException jpe) {
throw new APIMapperException(jpe.getMessage(), jpe);
}
}
/** /**
* Using the given {@code model}, {@link ObjectMapper} deserializes the given Json * Using the given {@code model}, {@link ObjectMapper} deserializes the given Json
* into a Java POJO * into a Java POJO

Loading…
Cancel
Save