java.lang.Object
pt.unl.fct.di.novasys.babel.generic.ProtoNotification

public class JSONDataNotification extends CommonDataNotification
A notification of new data parsed as a JSON string. The object is passed as an argument on the construct and is therefore parsed into a JSON string by the GSON package to passed the result unto the upper layers. Additionaly, the information about the original object type is stored as a field to help unparse the value if needed.
  • Field Details

    • NOTIFICATION_ID

      public static final short NOTIFICATION_ID
      See Also:
    • REPLY_ID

      public static final short REPLY_ID
      See Also:
    • gson

      public static final com.google.gson.Gson gson
  • Constructor Details

    • JSONDataNotification

      public JSONDataNotification(CommonOperationType type, String keySpaceID, String collectionID, String objectID, Object value)
      Constructs a JSONDataNotification with the given notification data type (READ, UPDATE, etc.), the keySpace identifier, the collection identifier and the collection identifier. The data is also passed as an argument and converted into a JSON string by the GSON package.
      Parameters:
      type - the data notification type
      keySpaceID - the keySpace identifier
      collectionID - the collection identifier
      objectID - the object identifier
      value - data to be converted into JSON
    • JSONDataNotification

      public JSONDataNotification(CommonOperationType type, String keySpaceID, String collectionID, String objectID, Object value, String message)
      Constructs a JSONDataNotification with the given notification data type (READ, UPDATE, etc.), the keySpace identifier, the collection identifier and the collection identifier. The data is also passed as an argument and converted into a JSON string by the GSON package. Additionally, a message is passed as an argument describing the contents of the notification.
      Parameters:
      type - the data notification type
      keySpaceID - the keySpace identifier
      collectionID - the collection identifier
      objectID - the object identifier
      value - data to be converted into JSON
      message - a message describing the contents of the notification
  • Method Details

    • getResult

      public String getResult()
      Gets the result of the operation as a JSON string.
      Returns:
      the result of the operation.
    • getResultType

      public Class<? extends Object> getResultType()
      Gets the class type associated with the result. This can aid in parsing the result back to a readable object.
      Returns:
      the class type associated with the result.