Example usage for com.fasterxml.jackson.databind ObjectMapper enable

List of usage examples for com.fasterxml.jackson.databind ObjectMapper enable

Introduction

In this page you can find the example usage for com.fasterxml.jackson.databind ObjectMapper enable.

Prototype

public ObjectMapper enable(SerializationFeature first, SerializationFeature... f) 

Source Link

Document

Method for enabling specified DeserializationConfig features.

Usage

From source file:com.redhat.red.offliner.alist.FoloReportArtifactListReader.java

private ObjectMapper newObjectMapper() {
    ObjectMapper mapper = new ObjectMapper();
    mapper.setSerializationInclusion(JsonInclude.Include.NON_EMPTY);
    mapper.configure(JsonGenerator.Feature.AUTO_CLOSE_JSON_CONTENT, true);

    mapper.enable(SerializationFeature.INDENT_OUTPUT, SerializationFeature.USE_EQUALITY_FOR_OBJECT_ID);

    mapper.enable(MapperFeature.AUTO_DETECT_FIELDS);
    //        disable( MapperFeature.AUTO_DETECT_GETTERS );

    mapper.disable(SerializationFeature.WRITE_NULL_MAP_VALUES, SerializationFeature.WRITE_EMPTY_JSON_ARRAYS);

    mapper.disable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES);

    mapper.registerModule(new FoloSerializerModule());

    return mapper;
}