public static ObjectMapper createDefaultMapper() { final ObjectMapper mapper = new ObjectMapper(); mapper.setSerializationInclusion(JsonInclude.Include.NON_NULL); mapper.configure(SerializationFeature.FAIL_ON_EMPTY_BEANS, false); mapper.configure(SerializationFeature.CLOSE_CLOSEABLE, true); mapper.disable(DeserializationFeature.ADJUST_DATES_TO_CONTEXT_TIME_ZONE); mapper.registerModule(CloseableIterableDeserializer.getModule()); // Allow unknown properties. This will help to avoid conflicts between Gaffer versions. mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, STRICT_JSON_DEFAULT); // Using the deprecated version for compatibility with older versions of jackson mapper.registerModule(new JSR310Module()); // Use the 'setFilters' method so it is compatible with older versions of jackson mapper.setFilters(getFilterProvider()); // Allow simple class names or full class names to be used in JSON. // We must set this to true to ensure serialisation into json uses the // full class name. Otherwise, json deserialisation may fail on worker nodes in Accumulo/HBase. SimpleClassNameCache.setUseFullNameForSerialisation(true); SimpleClassNameIdResolver.configureObjectMapper(mapper); return mapper; }
public static ObjectMapper createDefaultMapper() { final ObjectMapper mapper = new ObjectMapper(); mapper.setSerializationInclusion(JsonInclude.Include.NON_NULL); mapper.configure(SerializationFeature.FAIL_ON_EMPTY_BEANS, false); mapper.configure(SerializationFeature.CLOSE_CLOSEABLE, true); mapper.disable(DeserializationFeature.ADJUST_DATES_TO_CONTEXT_TIME_ZONE); mapper.registerModule(CloseableIterableDeserializer.getModule()); // Allow unknown properties. This will help to avoid conflicts between Gaffer versions. mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, STRICT_JSON_DEFAULT); // Using the deprecated version for compatibility with older versions of jackson mapper.registerModule(new JSR310Module()); // Use the 'setFilters' method so it is compatible with older versions of jackson mapper.setFilters(getFilterProvider()); // Allow simple class names or full class names to be used in JSON. // We must set this to true to ensure serialisation into json uses the // full class name. Otherwise, json deserialisation may fail on worker nodes in Accumulo/HBase. SimpleClassNameCache.setUseFullNameForSerialisation(true); SimpleClassNameIdResolver.configureObjectMapper(mapper); return mapper; }