io.dropwizard.jackson.AnnotationSensitivePropertyNamingStrategy Java Examples

The following examples show how to use io.dropwizard.jackson.AnnotationSensitivePropertyNamingStrategy. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: EmoServiceObjectMapperFactory.java    From emodb with Apache License 2.0 5 votes vote down vote up
public static ObjectMapper configure(ObjectMapper mapper) {
    return CustomJsonObjectMapperFactory.configure(mapper)
            .registerModule(new LogbackModule())
            .setDateFormat(new ISO8601DateFormat())
            .setPropertyNamingStrategy(new AnnotationSensitivePropertyNamingStrategy())
            .setSubtypeResolver(new DiscoverableSubtypeResolver());

}
 
Example #2
Source File: JsonHelpers.java    From keywhiz with Apache License 2.0 5 votes vote down vote up
/**
 * 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 GuavaExtrasModule());
  mapper.registerModule(new FuzzyEnumModule());
  mapper.setPropertyNamingStrategy(new AnnotationSensitivePropertyNamingStrategy());
  mapper.setSubtypeResolver(new DiscoverableSubtypeResolver());
  mapper.setSerializationInclusion(JsonInclude.Include.NON_NULL);
  return mapper;
}
 
Example #3
Source File: JacksonXML.java    From dropwizard-xml with Apache License 2.0 5 votes vote down vote up
/**
 * Creates a new {@link com.fasterxml.jackson.dataformat.xml.XmlMapper} using Woodstox
 * with Logback and Joda Time support.
 * Also includes all {@link io.dropwizard.jackson.Discoverable} interface implementations.
 *
 * @return XmlMapper
 */
public static XmlMapper newXMLMapper(JacksonXmlModule jacksonXmlModule) {

    final XmlFactory woodstoxFactory = new XmlFactory(new WstxInputFactory(), new WstxOutputFactory());
    final XmlMapper mapper = new XmlMapper(woodstoxFactory, jacksonXmlModule);

    mapper.registerModule(new GuavaModule());
    mapper.registerModule(new GuavaExtrasModule());
    mapper.registerModule(new JodaModule());
    mapper.registerModule(new FuzzyEnumModule());
    mapper.setPropertyNamingStrategy(new AnnotationSensitivePropertyNamingStrategy());
    mapper.setSubtypeResolver(new DiscoverableSubtypeResolver());

    return mapper;
}