Search in sources :

Example 6 with JaxbAnnotationIntrospector

use of com.fasterxml.jackson.module.jaxb.JaxbAnnotationIntrospector in project platformlayer by platformlayer.

the class JsonHelper method buildObjectMapper.

public static ObjectMapper buildObjectMapper(TypeFactory typeFactory, boolean formatted) {
    ObjectMapper mapper = new ObjectMapper();
    if (typeFactory == null) {
        typeFactory = TypeFactory.defaultInstance();
    }
    if (formatted) {
        mapper.enable(SerializationFeature.INDENT_OUTPUT);
    }
    // Favor JAXB annotations
    AnnotationIntrospector jaxbIntrospector = new JaxbAnnotationIntrospector(typeFactory);
    AnnotationIntrospector jacksonIntrospector = new JacksonAnnotationIntrospector();
    AnnotationIntrospector introspector = new AnnotationIntrospectorPair(jaxbIntrospector, jacksonIntrospector);
    mapper.setAnnotationIntrospector(introspector);
    return mapper;
}
Also used : JacksonAnnotationIntrospector(com.fasterxml.jackson.databind.introspect.JacksonAnnotationIntrospector) AnnotationIntrospectorPair(com.fasterxml.jackson.databind.introspect.AnnotationIntrospectorPair) JacksonAnnotationIntrospector(com.fasterxml.jackson.databind.introspect.JacksonAnnotationIntrospector) AnnotationIntrospector(com.fasterxml.jackson.databind.AnnotationIntrospector) JaxbAnnotationIntrospector(com.fasterxml.jackson.module.jaxb.JaxbAnnotationIntrospector) ObjectMapper(com.fasterxml.jackson.databind.ObjectMapper) JaxbAnnotationIntrospector(com.fasterxml.jackson.module.jaxb.JaxbAnnotationIntrospector)

Example 7 with JaxbAnnotationIntrospector

use of com.fasterxml.jackson.module.jaxb.JaxbAnnotationIntrospector in project midpoint by Evolveum.

the class JsonLexicalProcessor method configureMapperForSerialization.

private ObjectMapper configureMapperForSerialization() {
    ObjectMapper mapper = new ObjectMapper();
    mapper.configure(SerializationFeature.WRITE_NULL_MAP_VALUES, false);
    mapper.setSerializationInclusion(Include.NON_NULL);
    mapper.registerModule(createSerializerModule());
    mapper.setAnnotationIntrospector(new JaxbAnnotationIntrospector());
    return mapper;
}
Also used : ObjectMapper(com.fasterxml.jackson.databind.ObjectMapper) JaxbAnnotationIntrospector(com.fasterxml.jackson.module.jaxb.JaxbAnnotationIntrospector)

Aggregations

JaxbAnnotationIntrospector (com.fasterxml.jackson.module.jaxb.JaxbAnnotationIntrospector)7 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)5 AnnotationIntrospector (com.fasterxml.jackson.databind.AnnotationIntrospector)3 JacksonAnnotationIntrospector (com.fasterxml.jackson.databind.introspect.JacksonAnnotationIntrospector)2 MappingJsonFactory (com.fasterxml.jackson.databind.MappingJsonFactory)1 AnnotationIntrospectorPair (com.fasterxml.jackson.databind.introspect.AnnotationIntrospectorPair)1 ThreadFactoryBuilder (com.google.common.util.concurrent.ThreadFactoryBuilder)1 ScheduledThreadPoolExecutor (java.util.concurrent.ScheduledThreadPoolExecutor)1 Configuration (org.apache.hadoop.conf.Configuration)1 YarnConfiguration (org.apache.hadoop.yarn.conf.YarnConfiguration)1 TimelineACLsManager (org.apache.hadoop.yarn.server.timeline.security.TimelineACLsManager)1