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

com.buabook.http.common.jackson.ObjectMapperWithJsonObjectSupport Maven / Gradle / Ivy

There is a newer version: 1.0.2
Show newest version
package com.buabook.http.common.jackson;

import org.json.JSONObject;

import com.fasterxml.jackson.databind.ObjectMapper;

/**
 * 

Custom Jackson {@link ObjectMapper} with {@link JSONObject} Serialisation Support

* (c) 2016 Sport Trades Ltd * * @author Jas Rajasansir * @version 1.0.0 * @since 28 Nov 2016 */ public final class ObjectMapperWithJsonObjectSupport { private static ObjectMapper mapper; /** * NOTE: This method will only instantiate one {@link ObjectMapper}. Multiple calls to this method * will return the same object. * @return New Jackson object mapper with support to serialise {@link JSONObject}s. */ public static ObjectMapper newMapper() { if(mapper == null) { mapper = new ObjectMapper(); mapper.registerModule(new JsonObjectModule()); } return mapper; } }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy