com.buabook.http.common.jackson.ObjectMapperWithJsonObjectSupport Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of http-common Show documentation
Show all versions of http-common Show documentation
HTTP access functionality (c) 2016 - 2017 Sport Trades Ltd
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