public class JSONModeller
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
protected UnsafeAllocator |
allocator |
protected JSONCodecConfiguration |
cfg |
protected ReflectionHelper |
reflectionHelper |
protected static java.lang.String |
SPECIAL_ATTRIBUTE_CLASS |
Constructor and Description |
---|
JSONModeller(JSONCodecConfiguration cfg) |
Modifier and Type | Method and Description |
---|---|
<T> T |
toJavaObject(java.lang.Object jsonAny,
java.lang.Class<T> targetType) |
<T> T |
toJavaObject(java.lang.Object jsonAny,
T targetObject) |
java.lang.Object |
toJSON(java.lang.Object javaObject)
Encodes the given Java object into a JSON object.
|
java.lang.Object |
toJSON(java.lang.Object o,
java.lang.Class<?> referenceType)
returns a JSONObject, JSONArray or primitive value (including String)
depending on the given object and reference type.
|
protected static final java.lang.String SPECIAL_ATTRIBUTE_CLASS
protected ReflectionHelper reflectionHelper
protected UnsafeAllocator allocator
protected JSONCodecConfiguration cfg
public JSONModeller(JSONCodecConfiguration cfg)
public <T> T toJavaObject(java.lang.Object jsonAny, T targetObject) throws JSONException
JSONException
public <T> T toJavaObject(java.lang.Object jsonAny, java.lang.Class<T> targetType) throws JSONException
JSONException
public java.lang.Object toJSON(java.lang.Object javaObject) throws JSONException
JSONException
public java.lang.Object toJSON(java.lang.Object o, java.lang.Class<?> referenceType) throws JSONException
o
- Object to be encoded.referenceType
- Class of the object or some subclass, in case you want just a particular subset of the membersJSONException