public class SpincastJsonManager extends Object implements IJsonManager
| Constructor and Description |
|---|
SpincastJsonManager(com.google.inject.Provider<com.google.inject.Injector> guiceProvider,
IJsonObjectAssistedFactory jsonObjectFactory) |
| Modifier and Type | Method and Description |
|---|---|
protected void |
configureObjectMapper(com.fasterxml.jackson.databind.ObjectMapper objectMapper)
Configuration of the Jackson's ObjectMapper.
|
IJsonObject |
create() |
IJsonObject |
create(InputStream inputStream) |
IJsonObject |
create(String jsonString) |
IJsonArray |
createArray() |
protected com.fasterxml.jackson.databind.ObjectMapper |
createObjectManager()
Create the ObjectMapper
|
<T> T |
fromJsonInputStream(InputStream inputStream,
Class<T> clazz) |
Map<String,Object> |
fromJsonInputStreamToMap(InputStream inputStream) |
<T> T |
fromJsonString(String jsonString,
Class<T> clazz) |
Map<String,Object> |
fromJsonStringToMap(String jsonString) |
protected com.fasterxml.jackson.databind.JsonSerializer<Date> |
getDateSerializer() |
protected com.google.inject.Injector |
getGuice() |
protected org.spincast.shaded.org.apache.commons.lang3.time.FastDateFormat |
getIso8601DateParser1() |
protected org.spincast.shaded.org.apache.commons.lang3.time.FastDateFormat |
getIso8601DateParser2() |
protected org.spincast.shaded.org.apache.commons.lang3.time.FastDateFormat |
getIso8601DateParser3() |
protected org.spincast.shaded.org.apache.commons.lang3.time.FastDateFormat |
getIso8601DateParserDefault() |
protected com.fasterxml.jackson.core.util.DefaultPrettyPrinter |
getJacksonPrettyPrinter() |
protected String |
getJacksonPrettyPrinterIndentation() |
protected com.fasterxml.jackson.databind.JsonDeserializer<IJsonArray> |
getJsonArrayDeserializer() |
protected com.fasterxml.jackson.databind.JsonSerializer<IJsonArray> |
getJsonArraySerializer() |
protected com.fasterxml.jackson.databind.JsonDeserializer<IJsonObject> |
getJsonObjectDeserializer() |
protected IJsonObjectAssistedFactory |
getJsonObjectFactory() |
protected com.fasterxml.jackson.databind.JsonSerializer<IJsonObject> |
getJsonObjectSerializer() |
protected com.fasterxml.jackson.databind.ObjectMapper |
getObjectMapper() |
protected void |
injectDependencies(Object obj)
Once the deserialization of an Object is done,
we inject dependencies using Guice.
|
Date |
parseDateFromJson(String str)
Currently support ISO 8601 encoded dates.
|
protected void |
registerCustomModules(com.fasterxml.jackson.databind.ObjectMapper objectMapper) |
protected void |
registerDateModule(com.fasterxml.jackson.databind.ObjectMapper objectMapper)
Register our custom serializers for dates.
|
protected void |
registerIJsonObjectModule(com.fasterxml.jackson.databind.ObjectMapper objectMapper)
Register our custom (de)serializers for IJsonObject
|
String |
toJsonString(Object obj) |
String |
toJsonString(Object obj,
boolean pretty) |
@Inject
public SpincastJsonManager(com.google.inject.Provider<com.google.inject.Injector> guiceProvider,
IJsonObjectAssistedFactory jsonObjectFactory)
protected com.google.inject.Injector getGuice()
protected IJsonObjectAssistedFactory getJsonObjectFactory()
protected com.fasterxml.jackson.core.util.DefaultPrettyPrinter getJacksonPrettyPrinter()
protected String getJacksonPrettyPrinterIndentation()
protected org.spincast.shaded.org.apache.commons.lang3.time.FastDateFormat getIso8601DateParserDefault()
protected org.spincast.shaded.org.apache.commons.lang3.time.FastDateFormat getIso8601DateParser1()
protected org.spincast.shaded.org.apache.commons.lang3.time.FastDateFormat getIso8601DateParser2()
protected org.spincast.shaded.org.apache.commons.lang3.time.FastDateFormat getIso8601DateParser3()
protected com.fasterxml.jackson.databind.ObjectMapper getObjectMapper()
protected com.fasterxml.jackson.databind.ObjectMapper createObjectManager()
protected void configureObjectMapper(com.fasterxml.jackson.databind.ObjectMapper objectMapper)
protected com.fasterxml.jackson.databind.JsonSerializer<IJsonObject> getJsonObjectSerializer()
protected com.fasterxml.jackson.databind.JsonSerializer<IJsonArray> getJsonArraySerializer()
protected com.fasterxml.jackson.databind.JsonSerializer<Date> getDateSerializer()
protected com.fasterxml.jackson.databind.JsonDeserializer<IJsonObject> getJsonObjectDeserializer()
protected com.fasterxml.jackson.databind.JsonDeserializer<IJsonArray> getJsonArrayDeserializer()
protected void registerCustomModules(com.fasterxml.jackson.databind.ObjectMapper objectMapper)
protected void registerIJsonObjectModule(com.fasterxml.jackson.databind.ObjectMapper objectMapper)
protected void registerDateModule(com.fasterxml.jackson.databind.ObjectMapper objectMapper)
public String toJsonString(Object obj)
toJsonString in interface IJsonManagerpublic String toJsonString(Object obj, boolean pretty)
toJsonString in interface IJsonManagerprotected void injectDependencies(Object obj)
public <T> T fromJsonString(String jsonString, Class<T> clazz)
fromJsonString in interface IJsonManagerpublic <T> T fromJsonInputStream(InputStream inputStream, Class<T> clazz)
fromJsonInputStream in interface IJsonManagerpublic Map<String,Object> fromJsonStringToMap(String jsonString)
fromJsonStringToMap in interface IJsonManagerpublic Map<String,Object> fromJsonInputStreamToMap(InputStream inputStream)
fromJsonInputStreamToMap in interface IJsonManagerpublic IJsonObject create()
create in interface IJsonManagerpublic IJsonObject create(String jsonString)
create in interface IJsonManagerpublic IJsonObject create(InputStream inputStream)
create in interface IJsonManagerpublic IJsonArray createArray()
createArray in interface IJsonManagerpublic Date parseDateFromJson(String str)
parseDateFromJson in interface IJsonManagerCopyright © 2016. All rights reserved.