public.javadoc.org.spincast.plugins.jacksonjson.SpincastJsonManager.html Maven / Gradle / Ivy
                 Go to download
                
        
                    Show more of this group  Show more artifacts with this name
Show all versions of spincast-website Show documentation
                Show all versions of spincast-website Show documentation
Source code for the https://www.spincast.org website.
                
            
SpincastJsonManager (org.spincast:spincast-framework 0.9.21 API) 
org.spincast.plugins.jacksonjson
Class SpincastJsonManager
- java.lang.Object
 
- 
- org.spincast.plugins.jacksonjson.SpincastJsonManager
 
 
- 
- All Implemented Interfaces:
 
- IJsonManager
 
public class SpincastJsonManager
extends Object
implements IJsonManager
Spincast Jackson Json manager
 
- 
- 
Constructor Summary
Constructors  
Constructor and Description 
 
SpincastJsonManager(com.google.inject.Provider<com.google.inject.Injector> guiceProvider,
                   IJsonObjectFactory jsonObjectFactory,
                   Set<IJsonMixinInfo> jsonMixinInfos,
                   ISpincastJsonManagerConfig spincastJsonManagerConfig)  
 
 
- 
Method Summary
All Methods Instance Methods Concrete Methods  
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.
 
 
 
 
- 
- 
Constructor Detail
- 
SpincastJsonManager
@Inject
public SpincastJsonManager(com.google.inject.Provider<com.google.inject.Injector> guiceProvider,
                                    IJsonObjectFactory jsonObjectFactory,
                                    @Nullable
                                    Set<IJsonMixinInfo> jsonMixinInfos,
                                    ISpincastJsonManagerConfig spincastJsonManagerConfig)
 
 
- 
Method Detail
- 
getGuice
protected com.google.inject.Injector getGuice()
 
- 
getJsonObjectFactory
protected IJsonObjectFactory getJsonObjectFactory()
 
- 
getJsonMixinInfos
protected Set<IJsonMixinInfo> getJsonMixinInfos()
 
- 
getSpincastJsonManagerConfig
protected ISpincastJsonManagerConfig getSpincastJsonManagerConfig()
 
- 
getJacksonPrettyPrinter
protected com.fasterxml.jackson.core.util.DefaultPrettyPrinter getJacksonPrettyPrinter()
 
- 
getJacksonPrettyPrinterNewline
protected String getJacksonPrettyPrinterNewline()
 
- 
getJacksonPrettyPrinterIndentation
protected String getJacksonPrettyPrinterIndentation()
 
- 
getIso8601DateParserDefault
protected org.spincast.shaded.org.apache.commons.lang3.time.FastDateFormat getIso8601DateParserDefault()
 
- 
getIso8601DateParser1
protected org.spincast.shaded.org.apache.commons.lang3.time.FastDateFormat getIso8601DateParser1()
 
- 
getIso8601DateParser2
protected org.spincast.shaded.org.apache.commons.lang3.time.FastDateFormat getIso8601DateParser2()
 
- 
getIso8601DateParser3
protected org.spincast.shaded.org.apache.commons.lang3.time.FastDateFormat getIso8601DateParser3()
 
- 
getObjectMapper
protected com.fasterxml.jackson.databind.ObjectMapper getObjectMapper()
 
- 
createObjectManager
protected com.fasterxml.jackson.databind.ObjectMapper createObjectManager()
Creates the ObjectMapper
 
- 
configureObjectMapper
protected void configureObjectMapper(com.fasterxml.jackson.databind.ObjectMapper objectMapper)
Configuration of the ObjectMapper.
 
- 
configureEmptyBeans
protected void configureEmptyBeans(com.fasterxml.jackson.databind.ObjectMapper objectMapper)
 
- 
configureMixins
protected void configureMixins(com.fasterxml.jackson.databind.ObjectMapper objectMapper)
 
- 
getJsonObjectSerializer
protected com.fasterxml.jackson.databind.JsonSerializer<IJsonObject> getJsonObjectSerializer()
 
- 
getJsonArraySerializer
protected com.fasterxml.jackson.databind.JsonSerializer<IJsonArray> getJsonArraySerializer()
 
- 
getDateSerializer
protected com.fasterxml.jackson.databind.JsonSerializer<Date> getDateSerializer()
 
- 
getJsonObjectDeserializer
protected com.fasterxml.jackson.databind.JsonDeserializer<IJsonObject> getJsonObjectDeserializer()
 
- 
getJsonArrayDeserializer
protected com.fasterxml.jackson.databind.JsonDeserializer<IJsonArray> getJsonArrayDeserializer()
 
- 
registerCustomModules
protected void registerCustomModules(com.fasterxml.jackson.databind.ObjectMapper objectMapper)
 
- 
registerIJsonObjectModule
protected void registerIJsonObjectModule(com.fasterxml.jackson.databind.ObjectMapper objectMapper)
Register our custom (de)serializers for IJsonObject
 
- 
registerDateModule
protected void registerDateModule(com.fasterxml.jackson.databind.ObjectMapper objectMapper)
Register our custom serializers for dates.
 
- 
toJsonString
public String toJsonString(Object obj)
Description copied from interface: IJsonManager
Gets the Json String representation of 
 the specified object.
- Specified by:
 
toJsonString in interface IJsonManager 
 
- 
toJsonString
public String toJsonString(Object obj,
                           boolean pretty)
Description copied from interface: IJsonManager
Gets the Json String representation of the 
 specified object.
- Specified by:
 
toJsonString in interface IJsonManager 
pretty - if true, the generated 
 String will be formatted. 
 
- 
injectDependencies
protected void injectDependencies(Object obj)
Once the deserialization of an Object is done,
 we inject dependencies using Guice.
 
- 
fromJsonString
public <T> T fromJsonString(String jsonString,
                            Class<T> clazz)
Description copied from interface: IJsonManager
Creates an instance of the specified T type
 from a Json String.
- Specified by:
 
fromJsonString in interface IJsonManager 
 
- 
fromJsonInputStream
public <T> T fromJsonInputStream(InputStream inputStream,
                                 Class<T> clazz)
Description copied from interface: IJsonManager
Creates an instance of the specified T type
 from a Json inputStream.
- Specified by:
 
fromJsonInputStream in interface IJsonManager 
 
- 
fromJsonStringToMap
public Map<String,Object> fromJsonStringToMap(String jsonString)
Description copied from interface: IJsonManager
Creates a Map<String, Object> from a Json
 String.
- Specified by:
 
fromJsonStringToMap in interface IJsonManager 
 
- 
fromJsonInputStreamToMap
public Map<String,Object> fromJsonInputStreamToMap(InputStream inputStream)
Description copied from interface: IJsonManager
Creates a Map<String, Object> from a Json inputStream.
- Specified by:
 
fromJsonInputStreamToMap in interface IJsonManager 
 
- 
create
public IJsonObject create()
Description copied from interface: IJsonManager
Creates an empty JsonObject
- Specified by:
 
create in interface IJsonManager 
 
- 
create
public IJsonObject create(String jsonString)
Description copied from interface: IJsonManager
Creates a JsonObject from a Json
 String.
- Specified by:
 
create in interface IJsonManager 
 
- 
create
public IJsonObject create(InputStream inputStream)
Description copied from interface: IJsonManager
Creates a JsonObject from an inputStream.
- Specified by:
 
create in interface IJsonManager 
 
- 
createArray
public IJsonArray createArray()
Description copied from interface: IJsonManager
Creates an empty JsonArray.
- Specified by:
 
createArray in interface IJsonManager 
 
- 
createArray
public IJsonArray createArray(String jsonString)
Description copied from interface: IJsonManager
Creates a JsonArray from a Json
 String.
- Specified by:
 
createArray in interface IJsonManager 
 
- 
createArray
public IJsonArray createArray(InputStream inputStream)
Description copied from interface: IJsonManager
Creates a JsonArray from an inputStream.
- Specified by:
 
createArray in interface IJsonManager 
 
- 
parseDateFromJson
public Date parseDateFromJson(String str)
Currently support ISO 8601 encoded dates.
- Specified by:
 
parseDateFromJson in interface IJsonManager 
 
 
 
Copyright © 2016. All rights reserved.
    © 2015 - 2025 Weber Informatics LLC | Privacy Policy