Package com.cumulocity.model
Class JSONBase
- java.lang.Object
-
- org.svenson.AbstractDynamicProperties
-
- com.cumulocity.model.JSONBase
-
- All Implemented Interfaces:
Serializable
,org.svenson.DynamicProperties
- Direct Known Subclasses:
Document
public class JSONBase extends org.svenson.AbstractDynamicProperties
Base class for all the core classes represented in JSON.- Author:
- Sameer Babu KK
- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
JSONBase.JSONGeneratorBuilder
static class
JSONBase.JSONParserBuilder
static class
JSONBase.ReaderJSONCharacterSource
-
Field Summary
Fields Modifier and Type Field Description static String
ID_TYPE_CONVERTER_NAME
-
Constructor Summary
Constructors Constructor Description JSONBase()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static <T> T
fromJSON(Reader json, Class<T> type)
Unmarshall the JSON representation to an object of the specified type.static <T> T
fromJSON(String json, Class<T> type)
Unmarshall the JSON representation to an object of the specified type.static org.svenson.JSON
getJSONGenerator()
static org.svenson.JSON
getJSONGeneratorWithUTF8Encoding()
static org.svenson.JSONParser
getJSONParser()
String
toJSON()
Marshall the object representation to JSON using svenson library.
-
-
-
Field Detail
-
ID_TYPE_CONVERTER_NAME
public static final String ID_TYPE_CONVERTER_NAME
- See Also:
- Constant Field Values
-
-
Method Detail
-
toJSON
public String toJSON()
Marshall the object representation to JSON using svenson library. There different type converters defined and conversion uses the type converter repository.- Returns:
- the JSON representation.
-
fromJSON
public static <T> T fromJSON(String json, Class<T> type)
Unmarshall the JSON representation to an object of the specified type. There different type converters defined and conversion uses the type converter repository.- Parameters:
type
- The class typejson
- the json string- Returns:
- the object of the given type
-
fromJSON
public static <T> T fromJSON(Reader json, Class<T> type)
Unmarshall the JSON representation to an object of the specified type. There different type converters defined and conversion uses the type converter repository.- Parameters:
type
- The class typejson
- the json reader- Returns:
- the object of the given type
-
getJSONGenerator
@JSONProperty(ignore=true) public static org.svenson.JSON getJSONGenerator()
-
getJSONGeneratorWithUTF8Encoding
@JSONProperty(ignore=true) public static org.svenson.JSON getJSONGeneratorWithUTF8Encoding()
-
getJSONParser
@JSONProperty(ignore=true) public static org.svenson.JSONParser getJSONParser()
-
-