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

    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

    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

    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

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

    • objectData

      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

    • JSONObjectDataSource

      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

    • getPackedObject

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

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

      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 -