All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.github.dekobon.json.CloudApiObjectMapper Maven / Gradle / Ivy

package com.github.dekobon.json;

import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.SerializationFeature;
import com.fasterxml.jackson.datatype.threetenbp.ThreeTenModule;

/**
 * Customized and configured instance of {@link ObjectMapper}.
 *
 * @author Elijah Zupancic
 * @since 1.0.0
 */
public class CloudApiObjectMapper extends ObjectMapper {
    {
        configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);

        setSerializationInclusion(JsonInclude.Include.NON_NULL);
        registerModule(new ThreeTenModule());
        registerModule(new PostprocessModificationModule());
    }

    public CloudApiObjectMapper() {
    }

    public CloudApiObjectMapper(final boolean prettyPrint) {
        if (prettyPrint) {
            configure(SerializationFeature.INDENT_OUTPUT, true);
        }
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy