| Constructor and Description |
|---|
JsonUtilCH()
Instantiates a new Json util.
|
JsonUtilCH(org.codehaus.jackson.map.ObjectMapper objectMapper)
Instantiates a new Json util ch.
|
| Modifier and Type | Method and Description |
|---|---|
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
|
String |
toJsonString(Object object)
Method convert to json string for the input object
|
public JsonUtilCH()
public JsonUtilCH(org.codehaus.jackson.map.ObjectMapper objectMapper)
objectMapper - the object mapperpublic <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 <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.