All Downloads are FREE. Search and download functionalities are using the official Maven repository.

technology.dice.dicewhere.downloader.ObjectMapperInstance Maven / Gradle / Ivy

There is a newer version: 1.3.12
Show newest version
package technology.dice.dicewhere.downloader;

import com.fasterxml.jackson.annotation.JsonInclude.Include;
import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.SerializationFeature;

public class ObjectMapperInstance {
  public static final ObjectMapper INSTANCE = configureObjectMapper(new ObjectMapper());

  private ObjectMapperInstance() {}

  private static ObjectMapper configureObjectMapper(ObjectMapper mapper) {
    mapper.findAndRegisterModules();
    mapper.configure(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS, false);
    mapper.configure(SerializationFeature.WRITE_DATE_TIMESTAMPS_AS_NANOSECONDS, false);
    mapper.setSerializationInclusion(Include.NON_ABSENT);
    mapper.configure(SerializationFeature.FAIL_ON_EMPTY_BEANS, false);
    mapper.configure(DeserializationFeature.ACCEPT_FLOAT_AS_INT, false);
    mapper.configure(DeserializationFeature.READ_DATE_TIMESTAMPS_AS_NANOSECONDS, false);
    mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
    return mapper;
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy