Commit 3aa4884c authored by Matija Obreza's avatar Matija Obreza

Merge branch 'fix-filter-copy' into 'master'

Use object mapper with default config in filter copy method

See merge request genesys-pgr/application-blocks!62
parents 1fa20213 8690dff8
...@@ -61,11 +61,13 @@ public abstract class BasicModelFilter<T extends BasicModelFilter<T, R>, R exten ...@@ -61,11 +61,13 @@ public abstract class BasicModelFilter<T extends BasicModelFilter<T, R>, R exten
private static final ObjectMapper jsonizer = new ObjectMapper(); private static final ObjectMapper jsonizer = new ObjectMapper();
private static final ObjectMapper nonDefault = new ObjectMapper(); private static final ObjectMapper nonDefault = new ObjectMapper();
private static final ObjectMapper defaultMapper = new ObjectMapper();
static { static {
// Any objectMapper configuration goes here // Any objectMapper configuration goes here
jsonizer.setSerializationInclusion(Include.NON_NULL); jsonizer.setSerializationInclusion(Include.NON_NULL);
nonDefault.setSerializationInclusion(Include.NON_DEFAULT); nonDefault.setSerializationInclusion(Include.NON_DEFAULT);
defaultMapper.setSerializationInclusion(Include.USE_DEFAULTS);
} }
/** The id. */ /** The id. */
...@@ -236,7 +238,7 @@ public abstract class BasicModelFilter<T extends BasicModelFilter<T, R>, R exten ...@@ -236,7 +238,7 @@ public abstract class BasicModelFilter<T extends BasicModelFilter<T, R>, R exten
* @throws IOException Signals that an I/O exception has occurred. * @throws IOException Signals that an I/O exception has occurred.
*/ */
public <X> X copy(final Class<X> targetType) throws IOException { public <X> X copy(final Class<X> targetType) throws IOException {
return jsonizer.readValue(jsonizer.writeValueAsString(this), targetType); return defaultMapper.readValue(defaultMapper.writeValueAsString(this), targetType);
} }
@Override @Override
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment