Package jsonStorage

Class JSONObjectDataSource<DataSource extends JSONObjectData>

java.lang.Object
jsonStorage.JSONObjectDataSource<DataSource>
Direct Known Subclasses:
ClickBackgroundJSONDataSource, ClickJSONDataSource, WhistleJSONDataSource

public abstract class JSONObjectDataSource<DataSource extends JSONObjectData> extends Object
  • Field Summary Link icon

    Fields
    Modifier and Type
    Field
    Description
    protected DataSource
    The data object to load parameters into - this is what will be used to generate the JSON string.
  • Constructor Summary Link icon

    Constructors
    Modifier
    Constructor
    Description
    protected
    Don't do anything in the generic constructor, but the subclass that extends this class MUST INSTANTIATE A CONCRETE VERSION OF THE objectData FIELD USING THE CLASS-SPECIFIC JSONOBJECTDATA.
  • Method Summary Link icon

    Modifier and Type
    Method
    Description
    protected abstract void
    Add fields specific to this subclass
    Return a json-formatted string generated from the fields in this object
    protected abstract void
    Set the object type specific to this subclass.

    Methods inherited from class java.lang.Object Link icon

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details Link icon

    • objectData Link icon

      protected DataSource extends JSONObjectData objectData
      The data object to load parameters into - this is what will be used to generate the JSON string. Note that this must be initialised in the constructor of the subclass.
  • Constructor Details Link icon

    • JSONObjectDataSource Link icon

      protected JSONObjectDataSource()

      Don't do anything in the generic constructor, but the subclass that extends this class MUST INSTANTIATE A CONCRETE VERSION OF THE objectData FIELD USING THE CLASS-SPECIFIC JSONOBJECTDATA.

      Example: for the Whistle invalid input: '&' Moan Detector...

      • the class WhistleJSONData extends JSONObjectData
      • the class WhistleJSONDataSource extends JSONObjectDataSource...
      • ...and in it's constructor, it sets objectData = new WhistleJSONData();
  • Method Details Link icon

    • getPackedObject Link icon

      public String getPackedObject(PamDataUnit dataUnit)
      Return a json-formatted string generated from the fields in this object
      Returns:
    • addClassSpecificFields Link icon

      protected abstract void addClassSpecificFields(PamDataUnit pamDataUnit)
      Add fields specific to this subclass
    • setObjectType Link icon

      protected abstract void setObjectType(PamDataUnit pamDataUnit)
      Set the object type specific to this subclass. This is typically the objectType field from the subclass' implementation of the BInaryObjectData class. BinaryObjectData is often created in the subclass' BinaryDataSource.getPackedData() method.
      Parameters:
      pamDataUnit -