public class SpincastJsonManager extends Object implements IJsonManager
| Constructor and Description |
|---|
SpincastJsonManager(com.google.inject.Provider<com.google.inject.Injector> guiceProvider,
IJsonObjectFactory jsonObjectFactory,
Set<IJsonMixinInfo> jsonMixinInfos,
ISpincastJsonManagerConfig spincastJsonManagerConfig) |
| Modifier and Type | Method and Description |
|---|---|
protected void |
configureEmptyBeans(com.fasterxml.jackson.databind.ObjectMapper objectMapper) |
protected void |
configureMixins(com.fasterxml.jackson.databind.ObjectMapper objectMapper) |
protected void |
configureObjectMapper(com.fasterxml.jackson.databind.ObjectMapper objectMapper)
Configuration of the ObjectMapper.
|
IJsonObject |
create()
Creates an empty
JsonObject |
IJsonObject |
create(InputStream inputStream)
Creates a
JsonObject from an inputStream. |
IJsonObject |
create(String jsonString)
Creates a
JsonObject from a Json
String. |
IJsonArray |
createArray()
Creates an empty
JsonArray. |
IJsonArray |
createArray(InputStream inputStream)
Creates a
JsonArray from an inputStream. |
IJsonArray |
createArray(String jsonString)
Creates a
JsonArray from a Json
String. |
protected com.fasterxml.jackson.databind.ObjectMapper |
createObjectManager()
Creates the ObjectMapper
|
<T> T |
fromJsonInputStream(InputStream inputStream,
Class<T> clazz)
Creates an instance of the specified
T type
from a Json inputStream. |
Map<String,Object> |
fromJsonInputStreamToMap(InputStream inputStream)
Creates a
Map<String, Object> from a Json inputStream. |
<T> T |
fromJsonString(String jsonString,
Class<T> clazz)
Creates an instance of the specified
T type
from a Json String. |
Map<String,Object> |
fromJsonStringToMap(String jsonString)
Creates a
Map<String, Object> from a Json
String. |
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 String |
getJacksonPrettyPrinterNewline() |
protected com.fasterxml.jackson.databind.JsonDeserializer<IJsonArray> |
getJsonArrayDeserializer() |
protected com.fasterxml.jackson.databind.JsonSerializer<IJsonArray> |
getJsonArraySerializer() |
protected Set<IJsonMixinInfo> |
getJsonMixinInfos() |
protected com.fasterxml.jackson.databind.JsonDeserializer<IJsonObject> |
getJsonObjectDeserializer() |
protected IJsonObjectFactory |
getJsonObjectFactory() |
protected com.fasterxml.jackson.databind.JsonSerializer<IJsonObject> |
getJsonObjectSerializer() |
protected com.fasterxml.jackson.databind.ObjectMapper |
getObjectMapper() |
protected ISpincastJsonManagerConfig |
getSpincastJsonManagerConfig() |
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)
Gets the
Json String representation of
the specified object. |
String |
toJsonString(Object obj,
boolean pretty)
Gets the
Json String representation of the
specified object. |
@Inject
public SpincastJsonManager(com.google.inject.Provider<com.google.inject.Injector> guiceProvider,
IJsonObjectFactory jsonObjectFactory,
@Nullable
Set<IJsonMixinInfo> jsonMixinInfos,
ISpincastJsonManagerConfig spincastJsonManagerConfig)
protected com.google.inject.Injector getGuice()
protected IJsonObjectFactory getJsonObjectFactory()
protected Set<IJsonMixinInfo> getJsonMixinInfos()
protected ISpincastJsonManagerConfig getSpincastJsonManagerConfig()
protected com.fasterxml.jackson.core.util.DefaultPrettyPrinter getJacksonPrettyPrinter()
protected String getJacksonPrettyPrinterNewline()
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 void configureEmptyBeans(com.fasterxml.jackson.databind.ObjectMapper objectMapper)
protected void configureMixins(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)
IJsonManagerJson String representation of
the specified object.toJsonString in interface IJsonManagerpublic String toJsonString(Object obj, boolean pretty)
IJsonManagerJson String representation of the
specified object.toJsonString in interface IJsonManagerpretty - if true, the generated
String will be formatted.protected void injectDependencies(Object obj)
public <T> T fromJsonString(String jsonString, Class<T> clazz)
IJsonManagerT type
from a Json String.fromJsonString in interface IJsonManagerpublic <T> T fromJsonInputStream(InputStream inputStream, Class<T> clazz)
IJsonManagerT type
from a Json inputStream.fromJsonInputStream in interface IJsonManagerpublic Map<String,Object> fromJsonStringToMap(String jsonString)
IJsonManagerMap<String, Object> from a Json
String.fromJsonStringToMap in interface IJsonManagerpublic Map<String,Object> fromJsonInputStreamToMap(InputStream inputStream)
IJsonManagerMap<String, Object> from a Json inputStream.fromJsonInputStreamToMap in interface IJsonManagerpublic IJsonObject create()
IJsonManagerJsonObjectcreate in interface IJsonManagerpublic IJsonObject create(String jsonString)
IJsonManagerJsonObject from a Json
String.create in interface IJsonManagerpublic IJsonObject create(InputStream inputStream)
IJsonManagerJsonObject from an inputStream.create in interface IJsonManagerpublic IJsonArray createArray()
IJsonManagerJsonArray.createArray in interface IJsonManagerpublic IJsonArray createArray(String jsonString)
IJsonManagerJsonArray from a Json
String.createArray in interface IJsonManagerpublic IJsonArray createArray(InputStream inputStream)
IJsonManagerJsonArray from an inputStream.createArray in interface IJsonManagerpublic Date parseDateFromJson(String str)
parseDateFromJson in interface IJsonManagerCopyright © 2016. All rights reserved.