use of com.serotonin.m2m2.web.mvc.rest.v1.model.SuperclassModel in project ma-core-public by infiniteautomation.
the class SuperclassModelDeserializer method deserialize.
/* (non-Javadoc)
* @see com.fasterxml.jackson.databind.JsonDeserializer#deserialize(com.fasterxml.jackson.core.JsonParser, com.fasterxml.jackson.databind.DeserializationContext)
*/
@Override
public SuperclassModel<?> deserialize(JsonParser jp, DeserializationContext ctxt) throws IOException, JsonProcessingException {
ObjectMapper mapper = (ObjectMapper) jp.getCodec();
JsonNode tree = jp.readValueAsTree();
ModelDefinition definition = findModelDefinition(tree.get("type").asText());
return (SuperclassModel<?>) mapper.treeToValue(tree, definition.getModelClass());
}
Aggregations