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

io.wisetime.connector.config.TolerantObjectMapper Maven / Gradle / Ivy

There is a newer version: 2.2.6
Show newest version
/*
 * Copyright (c) 2018 Practice Insight Pty Ltd. All Rights Reserved.
 */

package io.wisetime.connector.config;

import com.fasterxml.jackson.core.JsonParser;
import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.MapperFeature;
import com.fasterxml.jackson.databind.ObjectMapper;

/**
 * A static singleton of a tolerant object mapper concerning additional of new fields and the like.
 *
 * @author [email protected]
 */
public class TolerantObjectMapper {

  public static ObjectMapper create() {
    return new ObjectMapper()
        .enable(JsonParser.Feature.ALLOW_COMMENTS)
        .enable(JsonParser.Feature.IGNORE_UNDEFINED)
        .configure(MapperFeature.ACCEPT_CASE_INSENSITIVE_PROPERTIES, true)
        .configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy