| Constructor and Description |
|---|
JsonUtilFX()
Instantiates a new Json util.
|
JsonUtilFX(com.fasterxml.jackson.databind.ObjectMapper objectMapper)
Instantiates a new Json util.
|
| Modifier and Type | Method and Description |
|---|---|
JsonUtilFX |
configure(com.fasterxml.jackson.databind.SerializationFeature serializationFeature,
boolean state)
Configure json util.
|
com.fasterxml.jackson.databind.ObjectMapper |
getOBJECT_MAPPER()
Gets a copy of object mapper.
|
String |
pretty(Object object)
Returns prettified json of the object
|
<T> List<T> |
readList(InputStream stream,
Class<T> clazz)
Parses the json to List of desired type
|
<T> List<T> |
readList(String json,
Class<T> clazz)
Parses the json to List of desired type
|
<K,V> Map<K,V> |
readMap(String json,
Class<K> keyClass,
Class<V> valueClass)
Parses the json to Map of desired type
|
<T> T |
readObject(InputStream jsonStream,
Class<T> clazz)
Parses the json to desired type
|
<T> T |
readObject(String json,
Class<T> clazz)
Reads json as Object
|
JsonUtil |
registerModules(com.fasterxml.jackson.databind.Module... modules)
Register modules json util.
|
JsonUtilFX |
setSerializationInclusion(com.fasterxml.jackson.annotation.JsonInclude.Include inclusion)
Set serialization inclusion json util.
|
String |
toJsonString(Object object)
Method convert to json string for the input object
|
public JsonUtilFX()
public JsonUtilFX(com.fasterxml.jackson.databind.ObjectMapper objectMapper)
objectMapper - the object mapperpublic JsonUtilFX configure(com.fasterxml.jackson.databind.SerializationFeature serializationFeature, boolean state)
serializationFeature - the serialization featurestate - the statepublic JsonUtilFX setSerializationInclusion(com.fasterxml.jackson.annotation.JsonInclude.Include inclusion)
inclusion - the inclusionpublic JsonUtil registerModules(com.fasterxml.jackson.databind.Module... modules)
modules - the modulespublic <T> T readObject(InputStream jsonStream, Class<T> clazz) throws CoreRtException
JsonUtilreadObject in interface JsonUtilT - GenericsjsonStream - The input streamclazz - The Object typeCoreRtException - in case of any Exceptionpublic <T> List<T> readList(InputStream stream, Class<T> clazz) throws CoreRtException
JsonUtilreadList in interface JsonUtilT - Genericsstream - The JSON streamclazz - The Object typeCoreRtException - in case of any Exceptionpublic com.fasterxml.jackson.databind.ObjectMapper getOBJECT_MAPPER()
public <T> List<T> readList(String json, Class<T> clazz) throws CoreRtException
JsonUtilreadList in interface JsonUtilT - Genericsjson - The JSONclazz - The Object typeCoreRtException - in case of any Exceptionpublic <K,V> Map<K,V> readMap(String json, Class<K> keyClass, Class<V> valueClass) throws CoreRtException
JsonUtilreadMap in interface JsonUtilK - GenericsV - Genericsjson - The JSONkeyClass - The Key TypevalueClass - The Value TypeCoreRtException - in case of any Exceptionpublic String toJsonString(Object object) throws CoreRtException
JsonUtiltoJsonString in interface JsonUtilobject - Object - The input objectString - The output json stringCoreRtException - in case of any Exceptionpublic <T> T readObject(String json, Class<T> clazz) throws CoreRtException
JsonUtilreadObject in interface JsonUtilT - Genericsjson - The jsonclazz - The class of ObjectCoreRtException - in case of any Exceptionpublic String pretty(Object object) throws CoreRtException
JsonUtilpretty in interface JsonUtilobject - The objectCoreRtException - in case of any ExceptionCopyright © 2018. All rights reserved.