com.cumulocity.model
Class JSONBase

java.lang.Object
  extended by org.svenson.AbstractDynamicProperties
      extended by com.cumulocity.model.JSONBase
All Implemented Interfaces:
org.svenson.DynamicProperties
Direct Known Subclasses:
AlarmList, Document, ExternalManagedObjectList, ManagedObjectList

public class JSONBase
extends org.svenson.AbstractDynamicProperties

Base class for all the core classes represented in JSON.

Author:
Sameer Babu KK

Constructor Summary
JSONBase()
           
 
Method Summary
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.JSONParser getJSONParser()
           
 String toJSON()
          Marshall the object representation to JSON using svenson library.
 
Methods inherited from class org.svenson.AbstractDynamicProperties
getProperty, propertyNames, setProperty
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JSONBase

public JSONBase()
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.

Type Parameters:
T - The class type
Parameters:
json - the json string
Returns:
the object of type

getJSONGenerator

@JSONProperty(ignore=true)
public static org.svenson.JSON getJSONGenerator()

getJSONParser

@JSONProperty(ignore=true)
public static org.svenson.JSONParser getJSONParser()


Copyright © 2013 (C) Cumulocity GmbH. All Rights Reserved.