package org.opendaylight.alto.commons.types.model150404; import java.io.IOException; import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; public class ModelJSONMapper { private ObjectMapper mapper = new ObjectMapper() .setSerializationInclusion(Include.NON_DEFAULT) .disable(DeserializationFeature.FAIL_ON_IGNORED_PROPERTIES); public ModelNetworkMap asNetworkMap(String json) throws Exception { return mapper.readValue(json, ModelNetworkMap.class); } public ModelEndpoint asModelEndpoint(String json) throws IOException { return mapper.readValue(json, ModelEndpoint.class); } public String asJSON(Object obj) throws Exception { return mapper.writeValueAsString(obj); } }