public interface IJsonManager
Json strings and objects.| Modifier and Type | Method and Description |
|---|---|
Object |
clone(Object originalObject)
Tries to clone an object to a
IJsonObject or
a IJsonArray, if the object is not of
a primitive type (or BigDecimal). |
Object |
clone(Object originalObject,
boolean mutable)
Tries to clone an object to a
IJsonObject or
a IJsonArray, if the object is not of
a primitive type (or BigDecimal). |
IJsonArray |
cloneJsonArray(IJsonArray jsonArray)
Deep copy of the
IJsonArray, so any
modification to the original won't affect the
clone, and vice-versa. |
IJsonArray |
cloneJsonArray(IJsonArray jsonArray,
boolean mutable)
Deep copy of the
IJsonArray, so any
modification to the original won't affect the
clone, and vice-versa. |
IJsonObject |
cloneJsonObject(IJsonObject jsonObject)
Deep copy of the
IJsonObject, so any
modification to the original won't affect the
clone, and vice-versa. |
IJsonObject |
cloneJsonObject(IJsonObject jsonObject,
boolean mutable)
Deep copy of the
IJsonObject, so any
modification to the original won't affect the
clone, and vice-versa. |
Object |
convertToNativeType(Object originalObject)
Convert a random object to a valid native Json type, if
it's not already.
|
IJsonObject |
create()
Creates an empty
JsonObject |
IJsonObject |
create(InputStream inputStream)
Creates a
JsonObject from an inputStream. |
IJsonObject |
create(Map<String,?> params)
Creates an empty
JsonObject based on the specified Map. |
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(List<?> elements)
Creates a
JsonArray from a List
of elements. |
IJsonArray |
createArray(String jsonString)
Creates a
JsonArray from a Json
String. |
IJsonArrayImmutable |
createArrayImmutable(IJsonArray jsonArray)
Make a
IJsonArray immutable, no element
could be added or removed on it. |
IJsonObjectImmutable |
createImmutable(IJsonObject jsonObject)
Make a
IJsonObject immutable, no element
could be added or removed on it. |
<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. |
Date |
parseDateFromJson(String str)
Converts a
Json date to a Java UTC date. |
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. |
IJsonObject create()
JsonObjectIJsonObject create(String jsonString)
JsonObject from a Json
String.IJsonObject create(Map<String,?> params)
JsonObject based on the specified Map.
An attempt will be made to create a deep copy of every elements so
a modification won't affect any external referecen and vice-versa.IJsonObject create(InputStream inputStream)
JsonObject from an inputStream.IJsonObjectImmutable createImmutable(IJsonObject jsonObject)
IJsonObject immutable, no element
could be added or removed on it.IJsonArray createArray()
JsonArray.IJsonArray createArray(String jsonString)
JsonArray from a Json
String.IJsonArray createArray(List<?> elements)
JsonArray from a List
of elements.IJsonArray createArray(InputStream inputStream)
JsonArray from an inputStream.IJsonArrayImmutable createArrayImmutable(IJsonArray jsonArray)
IJsonArray immutable, no element
could be added or removed on it.String toJsonString(Object obj)
Json String representation of
the specified object.String toJsonString(Object obj, boolean pretty)
Json String representation of the
specified object.pretty - if true, the generated
String will be formatted.Map<String,Object> fromJsonStringToMap(String jsonString)
Map<String, Object> from a Json
String.Map<String,Object> fromJsonInputStreamToMap(InputStream inputStream)
Map<String, Object> from a Json inputStream.<T> T fromJsonString(String jsonString, Class<T> clazz)
T type
from a Json String.<T> T fromJsonInputStream(InputStream inputStream, Class<T> clazz)
T type
from a Json inputStream.Object convertToNativeType(Object originalObject)
Object clone(Object originalObject)
IJsonObject or
a IJsonArray, if the object is not of
a primitive type (or BigDecimal).
The cloning is made by serializing the Object to a Json string, and deserializing back. So any (de)serialization rules apply.
The non primitive object will be cloned to a IJsonArray
if it is a :
Object clone(Object originalObject, boolean mutable)
IJsonObject or
a IJsonArray, if the object is not of
a primitive type (or BigDecimal).
The cloning is made by serializing the Object to a Json string, and deserializing back. So any (de)serialization rules apply.
The non primitive object will be cloned to a IJsonArray
if it is a :
mutable - if false, the resulting
Object and all its potential children
will be immutable.IJsonObject cloneJsonObject(IJsonObject jsonObject)
IJsonObject, so any
modification to the original won't affect the
clone, and vice-versa.
The resulting IJsonObject is mutable.
IJsonObject cloneJsonObject(IJsonObject jsonObject, boolean mutable)
IJsonObject, so any
modification to the original won't affect the
clone, and vice-versa.mutable - if false, the resulting
IJsonArray and all its children
will be immutable.IJsonArray cloneJsonArray(IJsonArray jsonArray)
IJsonArray, so any
modification to the original won't affect the
clone, and vice-versa.
The resulting IJsonArray is mutable.
IJsonArray cloneJsonArray(IJsonArray jsonArray, boolean mutable)
IJsonArray, so any
modification to the original won't affect the
clone, and vice-versa.mutable - if false, the resulting
IJsonArray and all its children
will be immutable.Copyright © 2016. All rights reserved.