Search in sources :

Example 1 with AnnotationSensitivePropertyNamingStrategy

use of io.dropwizard.jackson.AnnotationSensitivePropertyNamingStrategy in project keywhiz by square.

the class JsonHelpers method customizeObjectMapper.

/**
   * Customized ObjectMapper for common settings.
   *
   * @return customized object mapper
   */
private static ObjectMapper customizeObjectMapper() {
    ObjectMapper mapper = new ObjectMapper();
    mapper.registerModule(new Jdk8Module());
    mapper.registerModule(new GuavaModule());
    mapper.registerModule(new LogbackModule());
    mapper.registerModule(new GuavaExtrasModule());
    mapper.registerModule(new FuzzyEnumModule());
    mapper.setPropertyNamingStrategy(new AnnotationSensitivePropertyNamingStrategy());
    mapper.setSubtypeResolver(new DiscoverableSubtypeResolver());
    mapper.setSerializationInclusion(JsonInclude.Include.NON_NULL);
    return mapper;
}
Also used : Jdk8Module(com.fasterxml.jackson.datatype.jdk8.Jdk8Module) GuavaExtrasModule(io.dropwizard.jackson.GuavaExtrasModule) FuzzyEnumModule(io.dropwizard.jackson.FuzzyEnumModule) DiscoverableSubtypeResolver(io.dropwizard.jackson.DiscoverableSubtypeResolver) LogbackModule(io.dropwizard.jackson.LogbackModule) ObjectMapper(com.fasterxml.jackson.databind.ObjectMapper) GuavaModule(com.fasterxml.jackson.datatype.guava.GuavaModule) AnnotationSensitivePropertyNamingStrategy(io.dropwizard.jackson.AnnotationSensitivePropertyNamingStrategy)

Aggregations

ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)1 GuavaModule (com.fasterxml.jackson.datatype.guava.GuavaModule)1 Jdk8Module (com.fasterxml.jackson.datatype.jdk8.Jdk8Module)1 AnnotationSensitivePropertyNamingStrategy (io.dropwizard.jackson.AnnotationSensitivePropertyNamingStrategy)1 DiscoverableSubtypeResolver (io.dropwizard.jackson.DiscoverableSubtypeResolver)1 FuzzyEnumModule (io.dropwizard.jackson.FuzzyEnumModule)1 GuavaExtrasModule (io.dropwizard.jackson.GuavaExtrasModule)1 LogbackModule (io.dropwizard.jackson.LogbackModule)1