Commit 8690dff8 authored by Maxym Borodenko's avatar Maxym Borodenko

Use object mapper with default config in filter copy method

parent 1fa20213
......@@ -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 nonDefault = new ObjectMapper();
private static final ObjectMapper defaultMapper = new ObjectMapper();
static {
// Any objectMapper configuration goes here
jsonizer.setSerializationInclusion(Include.NON_NULL);
nonDefault.setSerializationInclusion(Include.NON_DEFAULT);
defaultMapper.setSerializationInclusion(Include.USE_DEFAULTS);
}
/** The id. */
......@@ -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.
*/
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
......
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