Example usage for com.fasterxml.jackson.datatype.joda JodaMapper configure

List of usage examples for com.fasterxml.jackson.datatype.joda JodaMapper configure

Introduction

In this page you can find the example usage for com.fasterxml.jackson.datatype.joda JodaMapper configure.

Prototype

public ObjectMapper configure(MapperFeature f, boolean state) 

Source Link

Document

Method for changing state of an on/off mapper feature for this mapper instance.

Usage

From source file:DataTools.ConvertObjectToJson.java

public static <R> R convertToObject(String json, Class<R> type) {
    R mapped = null;//from   w ww  .  j  a  v a 2 s  .c om
    JodaMapper mapper = new JodaMapper();
    mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false)
            .configure(DeserializationFeature.READ_UNKNOWN_ENUM_VALUES_AS_NULL, true);
    try {
        mapped = mapper.readValue(json, type);
    } catch (IOException e) {
        e.printStackTrace();
    }
    return mapped;
}