public class SpincastJsonManager extends Object implements JsonManager
| Modifier and Type | Field and Description |
|---|---|
static String |
ENUM_SERIALIZER_FIELD_NAME_LABEL |
static String |
ENUM_SERIALIZER_FIELD_NAME_NAME |
protected org.slf4j.Logger |
logger |
| Constructor and Description |
|---|
SpincastJsonManager(com.google.inject.Provider<com.google.inject.Injector> guiceProvider,
JsonObjectFactory jsonObjectFactory,
Set<JsonMixinInfo> jsonMixinInfos,
SpincastJsonManagerConfig spincastJsonManagerConfig,
SpincastConfig spincastConfig,
JsonPathUtils jsonPathUtils,
SpincastUtils spincastUtils,
FormFactory formFactory) |
| Modifier and Type | Method and Description |
|---|---|
Object |
clone(Object originalObject) |
Object |
clone(Object originalObject,
boolean mutable) |
JsonArray |
cloneJsonArray(JsonArray jsonArray,
boolean mutable) |
JsonObject |
cloneJsonObject(JsonObject jsonObject,
boolean mutable) |
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.
|
String |
convertToJsonDate(Date date) |
Object |
convertToNativeType(Object originalObject) |
JsonObject |
create() |
JsonArray |
createArray() |
Form |
createForm(String formName) |
protected com.fasterxml.jackson.databind.ObjectMapper |
createObjectManager()
Creates the ObjectMapper
|
JsonArray |
enumsToFriendlyJsonArray(Enum<?>[] enumValues) |
JsonObject |
enumToFriendlyJsonObject(Enum<?> enumValue) |
JsonObject |
fromClasspathFile(String path) |
JsonObject |
fromFile(File jsonFile) |
JsonObject |
fromFile(String path) |
JsonObject |
fromInputStream(InputStream inputStream) |
<T> T |
fromInputStream(InputStream inputStream,
Class<T> clazz) |
JsonArray |
fromInputStreamArray(InputStream inputStream) |
Map<String,Object> |
fromInputStreamToMap(InputStream inputStream) |
JsonArray |
fromListArray(List<?> elements) |
JsonObject |
fromMap(Map<String,?> params) |
JsonObject |
fromMap(Map<String,?> params,
boolean parseKeysAsJsonPaths) |
JsonObject |
fromString(String jsonString) |
<T> T |
fromString(String jsonString,
Class<T> clazz) |
JsonArray |
fromStringArray(String jsonString) |
Map<String,Object> |
fromStringToMap(String jsonString) |
protected com.fasterxml.jackson.databind.JsonSerializer<BigDecimal> |
getBigDecimalSerializer() |
protected com.fasterxml.jackson.databind.JsonSerializer<Date> |
getDateSerializer() |
Object |
getElementAtJsonPath(JsonArray array,
String jsonPath) |
Object |
getElementAtJsonPath(JsonArray array,
String jsonPath,
Object defaultValue) |
Object |
getElementAtJsonPath(JsonObject obj,
String jsonPath) |
Object |
getElementAtJsonPath(JsonObject obj,
String jsonPath,
Object defaultValue) |
protected com.fasterxml.jackson.databind.JsonSerializer<Enum<?>> |
getEnumSerializer() |
protected FormFactory |
getFormFactory() |
protected com.google.inject.Injector |
getGuice() |
protected com.fasterxml.jackson.databind.JsonSerializer<Instant> |
getInstantSerializer() |
protected com.fasterxml.jackson.core.util.DefaultPrettyPrinter |
getJacksonPrettyPrinter() |
protected String |
getJacksonPrettyPrinterIndentation() |
protected String |
getJacksonPrettyPrinterNewline() |
protected com.fasterxml.jackson.databind.JsonDeserializer<JsonArray> |
getJsonArrayDeserializer() |
protected com.fasterxml.jackson.databind.JsonSerializer<JsonArray> |
getJsonArraySerializer() |
protected Set<JsonMixinInfo> |
getJsonMixinInfos() |
protected com.fasterxml.jackson.databind.JsonDeserializer<JsonObject> |
getJsonObjectDeserializer() |
protected JsonObjectFactory |
getJsonObjectFactory() |
protected com.fasterxml.jackson.databind.JsonSerializer<JsonObject> |
getJsonObjectSerializer() |
protected JsonPathUtils |
getJsonPathUtils() |
protected int |
getMaxNumberOfKeysWhenConvertingMapToJsonObject() |
protected com.fasterxml.jackson.databind.ObjectMapper |
getObjectMapper() |
protected SpincastConfig |
getSpincastConfig() |
protected SpincastJsonManagerConfig |
getSpincastJsonManagerConfig() |
protected SpincastUtils |
getSpincastUtils() |
protected void |
injectDependencies(Object obj)
Once the deserialization of an Object is done,
we inject dependencies using Guice.
|
protected boolean |
isAllowCommentsInJson()
Should comments be accepted in Json?
|
boolean |
isElementExists(JsonArray array,
String jsonPath) |
boolean |
isElementExists(JsonObject obj,
String jsonPath) |
Date |
parseDateFromJson(String str)
Currently support ISO 8601 encoded dates.
|
void |
putElementAtJsonPath(JsonObjectOrArray objOrArray,
String jsonPath,
Object value) |
void |
putElementAtJsonPath(JsonObjectOrArray objOrArray,
String jsonPath,
Object value,
boolean clone) |
protected void |
registerCustomModules(com.fasterxml.jackson.databind.ObjectMapper objectMapper) |
protected void |
registerCustomTypeSerializerModule(com.fasterxml.jackson.databind.ObjectMapper objectMapper)
Register our custom serializers for some types.
|
protected void |
registerJsonObjectModule(com.fasterxml.jackson.databind.ObjectMapper objectMapper)
Register our custom (de)serializers for JsonObject
|
void |
removeElementAtJsonPath(JsonArray array,
String jsonPath) |
void |
removeElementAtJsonPath(JsonObject obj,
String jsonPath) |
String |
toJsonString(Object obj) |
String |
toJsonString(Object obj,
boolean pretty) |
protected final org.slf4j.Logger logger
public static final String ENUM_SERIALIZER_FIELD_NAME_NAME
public static final String ENUM_SERIALIZER_FIELD_NAME_LABEL
@Inject
public SpincastJsonManager(com.google.inject.Provider<com.google.inject.Injector> guiceProvider,
JsonObjectFactory jsonObjectFactory,
@Nullable
Set<JsonMixinInfo> jsonMixinInfos,
SpincastJsonManagerConfig spincastJsonManagerConfig,
SpincastConfig spincastConfig,
JsonPathUtils jsonPathUtils,
SpincastUtils spincastUtils,
FormFactory formFactory)
protected com.google.inject.Injector getGuice()
protected JsonObjectFactory getJsonObjectFactory()
protected Set<JsonMixinInfo> getJsonMixinInfos()
protected SpincastJsonManagerConfig getSpincastJsonManagerConfig()
protected SpincastConfig getSpincastConfig()
protected JsonPathUtils getJsonPathUtils()
protected SpincastUtils getSpincastUtils()
protected FormFactory getFormFactory()
protected com.fasterxml.jackson.core.util.DefaultPrettyPrinter getJacksonPrettyPrinter()
protected String getJacksonPrettyPrinterNewline()
protected String getJacksonPrettyPrinterIndentation()
protected com.fasterxml.jackson.databind.ObjectMapper getObjectMapper()
protected com.fasterxml.jackson.databind.ObjectMapper createObjectManager()
protected void configureObjectMapper(com.fasterxml.jackson.databind.ObjectMapper objectMapper)
protected boolean isAllowCommentsInJson()
https://github.com/FasterXML/jackson-core/wiki/JsonParser-Features#support-for-non-standard-data-format-constructsprotected void configureEmptyBeans(com.fasterxml.jackson.databind.ObjectMapper objectMapper)
protected void configureMixins(com.fasterxml.jackson.databind.ObjectMapper objectMapper)
protected com.fasterxml.jackson.databind.JsonSerializer<JsonObject> getJsonObjectSerializer()
protected com.fasterxml.jackson.databind.JsonSerializer<Enum<?>> getEnumSerializer()
protected com.fasterxml.jackson.databind.JsonSerializer<JsonArray> getJsonArraySerializer()
protected com.fasterxml.jackson.databind.JsonSerializer<Date> getDateSerializer()
protected com.fasterxml.jackson.databind.JsonSerializer<Instant> getInstantSerializer()
protected com.fasterxml.jackson.databind.JsonSerializer<BigDecimal> getBigDecimalSerializer()
protected com.fasterxml.jackson.databind.JsonDeserializer<JsonObject> getJsonObjectDeserializer()
protected com.fasterxml.jackson.databind.JsonDeserializer<JsonArray> getJsonArrayDeserializer()
protected void registerCustomModules(com.fasterxml.jackson.databind.ObjectMapper objectMapper)
protected void registerJsonObjectModule(com.fasterxml.jackson.databind.ObjectMapper objectMapper)
protected void registerCustomTypeSerializerModule(com.fasterxml.jackson.databind.ObjectMapper objectMapper)
public String toJsonString(Object obj)
toJsonString in interface JsonManagerpublic String toJsonString(Object obj, boolean pretty)
toJsonString in interface JsonManagerprotected void injectDependencies(Object obj)
public JsonObject create()
create in interface JsonManagerpublic JsonArray createArray()
createArray in interface JsonManagerpublic <T> T fromString(String jsonString, Class<T> clazz)
fromString in interface JsonManagerpublic <T> T fromInputStream(InputStream inputStream, Class<T> clazz)
fromInputStream in interface JsonManagerpublic Map<String,Object> fromStringToMap(String jsonString)
fromStringToMap in interface JsonManagerpublic Map<String,Object> fromInputStreamToMap(InputStream inputStream)
fromInputStreamToMap in interface JsonManagerpublic JsonObject fromString(String jsonString)
fromString in interface JsonManagerpublic JsonObject fromMap(Map<String,?> params)
fromMap in interface JsonManagerpublic JsonObject fromMap(Map<String,?> params, boolean parseKeysAsJsonPaths)
fromMap in interface JsonManagerpublic JsonObject fromInputStream(InputStream inputStream)
fromInputStream in interface JsonManagerpublic JsonObject fromFile(File jsonFile)
fromFile in interface JsonManagerpublic JsonObject fromFile(String path)
fromFile in interface JsonManagerpublic JsonObject fromClasspathFile(String path)
fromClasspathFile in interface JsonManagerpublic JsonArray fromStringArray(String jsonString)
fromStringArray in interface JsonManagerpublic JsonArray fromListArray(List<?> elements)
fromListArray in interface JsonManagerpublic JsonArray fromInputStreamArray(InputStream inputStream)
fromInputStreamArray in interface JsonManagerprotected int getMaxNumberOfKeysWhenConvertingMapToJsonObject()
public Object getElementAtJsonPath(JsonObject obj, String jsonPath)
getElementAtJsonPath in interface JsonManagerpublic Object getElementAtJsonPath(JsonObject obj, String jsonPath, Object defaultValue)
getElementAtJsonPath in interface JsonManagerpublic Object getElementAtJsonPath(JsonArray array, String jsonPath)
getElementAtJsonPath in interface JsonManagerpublic Object getElementAtJsonPath(JsonArray array, String jsonPath, Object defaultValue)
getElementAtJsonPath in interface JsonManagerpublic void putElementAtJsonPath(JsonObjectOrArray objOrArray, String jsonPath, Object value)
putElementAtJsonPath in interface JsonManagerpublic void putElementAtJsonPath(JsonObjectOrArray objOrArray, String jsonPath, Object value, boolean clone)
putElementAtJsonPath in interface JsonManagerpublic Form createForm(String formName)
createForm in interface JsonManagerpublic String convertToJsonDate(Date date)
convertToJsonDate in interface JsonManagerpublic Date parseDateFromJson(String str)
parseDateFromJson in interface JsonManagerpublic Object convertToNativeType(Object originalObject)
convertToNativeType in interface JsonManagerpublic JsonObject cloneJsonObject(JsonObject jsonObject, boolean mutable)
cloneJsonObject in interface JsonManagerpublic JsonArray cloneJsonArray(JsonArray jsonArray, boolean mutable)
cloneJsonArray in interface JsonManagerpublic Object clone(Object originalObject)
clone in interface JsonManagerpublic Object clone(Object originalObject, boolean mutable)
clone in interface JsonManagerpublic void removeElementAtJsonPath(JsonObject obj, String jsonPath)
removeElementAtJsonPath in interface JsonManagerpublic void removeElementAtJsonPath(JsonArray array, String jsonPath)
removeElementAtJsonPath in interface JsonManagerpublic boolean isElementExists(JsonObject obj, String jsonPath)
isElementExists in interface JsonManagerpublic boolean isElementExists(JsonArray array, String jsonPath)
isElementExists in interface JsonManagerpublic JsonObject enumToFriendlyJsonObject(Enum<?> enumValue)
enumToFriendlyJsonObject in interface JsonManagerpublic JsonArray enumsToFriendlyJsonArray(Enum<?>[] enumValues)
enumsToFriendlyJsonArray in interface JsonManagerCopyright © 2018. All rights reserved.