Example usage for com.fasterxml.jackson.module.jaxb JaxbAnnotationIntrospector JaxbAnnotationIntrospector

List of usage examples for com.fasterxml.jackson.module.jaxb JaxbAnnotationIntrospector JaxbAnnotationIntrospector

Introduction

In this page you can find the example usage for com.fasterxml.jackson.module.jaxb JaxbAnnotationIntrospector JaxbAnnotationIntrospector.

Prototype

public JaxbAnnotationIntrospector(TypeFactory typeFactory) 

Source Link

Usage

From source file:org.openengsb.core.util.JsonUtils.java

public static ObjectMapper createObjectMapperWithIntroSpectors() {
    ObjectMapper mapper = new ObjectMapper();
    AnnotationIntrospector primaryIntrospector = new JacksonAnnotationIntrospector();
    AnnotationIntrospector secondaryIntrospector = new JaxbAnnotationIntrospector(mapper.getTypeFactory());
    AnnotationIntrospector introspector = new AnnotationIntrospectorPair(primaryIntrospector,
            secondaryIntrospector);/*  w w w . j  a v a 2 s .  co  m*/
    mapper.getDeserializationConfig().withAppendedAnnotationIntrospector(introspector);
    mapper.getSerializationConfig().withAppendedAnnotationIntrospector(introspector);
    return mapper;
}

From source file:fr.norad.jaxrs.doc.plugin.DocGeneratorMojo.java

public DocGeneratorMojo() {
    objectMapper = new ObjectMapper();
    objectMapper.setSerializationInclusion(Include.NON_NULL);
    objectMapper.setAnnotationIntrospector(new AnnotationIntrospectorPair(new JacksonAnnotationIntrospector(),
            new JaxbAnnotationIntrospector(TypeFactory.defaultInstance())));
}

From source file:org.axiom_tools.codecs.ModelCodec.java

/**
 * Returns a new JSON object mapper./* w  w  w  .j av  a 2  s  .  com*/
 */
private ObjectMapper buildObjectMapper() {
    ObjectMapper result = new ObjectMapper();
    result.setAnnotationIntrospector(new JaxbAnnotationIntrospector(result.getTypeFactory()));
    result.enable(SerializationFeature.INDENT_OUTPUT);
    return result;
}

From source file:com.dell.asm.asmcore.asmmanager.util.ServiceTemplateUtil.java

private static ObjectMapper buildBackendObjectMapper() {
    ObjectMapper mapper = new ObjectMapper();
    AnnotationIntrospector ai = new JaxbAnnotationIntrospector(mapper.getTypeFactory());
    mapper.setAnnotationIntrospector(ai);
    mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
    return mapper;
}

From source file:org.apache.nifi.toolkit.cli.impl.client.nifi.impl.JerseyNiFiClient.java

private static JacksonJaxbJsonProvider jacksonJaxbJsonProvider() {
    JacksonJaxbJsonProvider jacksonJaxbJsonProvider = new JacksonJaxbJsonProvider();

    ObjectMapper mapper = new ObjectMapper();
    mapper.setDefaultPropertyInclusion(// w w  w  .jav  a 2s  .co  m
            JsonInclude.Value.construct(JsonInclude.Include.NON_NULL, JsonInclude.Include.NON_NULL));
    mapper.setAnnotationIntrospector(new JaxbAnnotationIntrospector(mapper.getTypeFactory()));
    // Ignore unknown properties so that deployed client remain compatible with future versions of NiFi that add new fields
    mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);

    jacksonJaxbJsonProvider.setMapper(mapper);
    return jacksonJaxbJsonProvider;
}

From source file:org.apache.nifi.registry.client.impl.JerseyNiFiRegistryClient.java

private static JacksonJaxbJsonProvider jacksonJaxbJsonProvider() {
    JacksonJaxbJsonProvider jacksonJaxbJsonProvider = new JacksonJaxbJsonProvider();

    ObjectMapper mapper = new ObjectMapper();
    mapper.setPropertyInclusion(//www . j  a va  2 s  .  c om
            JsonInclude.Value.construct(JsonInclude.Include.NON_NULL, JsonInclude.Include.NON_NULL));
    mapper.setAnnotationIntrospector(new JaxbAnnotationIntrospector(mapper.getTypeFactory()));
    // Ignore unknown properties so that deployed client remain compatible with future versions of NiFi Registry that add new fields
    mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);

    SimpleModule module = new SimpleModule();
    module.addDeserializer(BucketItem[].class, new BucketItemDeserializer());
    mapper.registerModule(module);

    jacksonJaxbJsonProvider.setMapper(mapper);
    return jacksonJaxbJsonProvider;
}

From source file:com.dell.asm.asmcore.asmmanager.app.rest.DeploymentService.java

static ObjectMapper buildObjectMapper() {
    ObjectMapper mapper = new ObjectMapper();
    AnnotationIntrospector ai = new JaxbAnnotationIntrospector(mapper.getTypeFactory());
    mapper.setAnnotationIntrospector(ai);
    return mapper;
}

From source file:com.dell.asm.asmcore.asmmanager.app.rest.ServiceTemplateService.java

static ObjectMapper buildObjectMapper() {
    ObjectMapper mapper = new ObjectMapper();
    AnnotationIntrospector ai = new JaxbAnnotationIntrospector(mapper.getTypeFactory());
    mapper.setAnnotationIntrospector(ai);
    mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
    return mapper;
}

From source file:org.openecomp.sdnc.sli.aai.AAIService.java

public static ObjectMapper getObjectMapper() {
    ObjectMapper mapper = new ObjectMapper();
    AnnotationIntrospector introspector = new JaxbAnnotationIntrospector(TypeFactory.defaultInstance());
    AnnotationIntrospector secondary = new JacksonAnnotationIntrospector();
    mapper.setAnnotationIntrospector(AnnotationIntrospector.pair(introspector, secondary));
    mapper.disable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES);
    mapper.setSerializationInclusion(Include.NON_NULL);
    return mapper;
}