review comments

This commit is contained in:
Rodica Sutu
2017-01-30 13:29:05 +02:00
parent 596eb3a937
commit ed55ed7176

View File

@@ -84,9 +84,11 @@ public class PojoUtility
public static String toJsonElectronicRecord(Object model) throws JsonProcessingException public static String toJsonElectronicRecord(Object model) throws JsonProcessingException
{ {
ObjectMapper mapper = new ObjectMapper(); ObjectMapper mapper = new ObjectMapper();
//inject the "mix-in" annotations from FilePlanComponentMix to //inject the "mix-in" annotations from FilePlanComponentMix to
// FilePlanComponent POJO class when converting to json // FilePlanComponent POJO class when converting to json
mapper.addMixIn(FilePlanComponent.class, FilePlanComponentMix.class); mapper.addMixIn(FilePlanComponent.class, FilePlanComponentMix.class);
//include only values that differ from default settings to be included //include only values that differ from default settings to be included
mapper.setSerializationInclusion(Include.NON_DEFAULT); mapper.setSerializationInclusion(Include.NON_DEFAULT);
try try
@@ -95,13 +97,16 @@ public class PojoUtility
//return the json object //return the json object
return mapper.writerWithDefaultPrettyPrinter().writeValueAsString(model); return mapper.writerWithDefaultPrettyPrinter().writeValueAsString(model);
} catch (JsonGenerationException e) }
catch (JsonGenerationException e)
{ {
return e.toString(); return e.toString();
} catch (JsonMappingException e) }
catch (JsonMappingException e)
{ {
return e.toString(); return e.toString();
} catch (IOException e) }
catch (IOException e)
{ {
return e.toString(); return e.toString();
} }