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:
  • Field Details

  • Constructor Details

    • JSONBase

      public JSONBase()
  • Method Details

    • 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 type
      json - 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 type
      json - 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()