1 package org.opendaylight.alto.commons.types.model150404;
3 import com.fasterxml.jackson.annotation.JsonInclude.Include;
4 import com.fasterxml.jackson.databind.DeserializationFeature;
5 import com.fasterxml.jackson.databind.ObjectMapper;
7 public class ModelJSONMapper {
9 private ObjectMapper mapper = new ObjectMapper()
10 .setSerializationInclusion(Include.NON_DEFAULT)
11 .disable(DeserializationFeature.FAIL_ON_IGNORED_PROPERTIES);
13 public ModelNetworkMap asNetworkMap(String json) throws Exception {
14 return mapper.readValue(json, ModelNetworkMap.class);
17 public String asJSON(Object obj) throws Exception {
18 return mapper.writeValueAsString(obj);