Class JSONDataNotification
java.lang.Object
pt.unl.fct.di.novasys.babel.generic.ProtoNotification
pt.unl.fct.di.novasys.babel.protocols.storage.notifications.common.CommonNotification
pt.unl.fct.di.novasys.babel.protocols.storage.notifications.common.CommonDataNotification
pt.unl.fct.di.novasys.babel.protocols.storage.notifications.JSONDataNotification
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 Summary
FieldsModifier and TypeFieldDescriptionstatic final com.google.gson.Gsonstatic final shortstatic final short -
Constructor Summary
ConstructorsConstructorDescriptionJSONDataNotification(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.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. -
Method Summary
Modifier and TypeMethodDescriptionGets the result of the operation as a JSON string.Gets the class type associated with the result.Methods inherited from class pt.unl.fct.di.novasys.babel.protocols.storage.notifications.common.CommonDataNotification
getCollectionID, getKeySpaceID, getObjectID, getTypeMethods inherited from class pt.unl.fct.di.novasys.babel.protocols.storage.notifications.common.CommonNotification
getMessageMethods inherited from class pt.unl.fct.di.novasys.babel.generic.ProtoNotification
getId
-
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 typekeySpaceID- the keySpace identifiercollectionID- the collection identifierobjectID- the object identifiervalue- 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 typekeySpaceID- the keySpace identifiercollectionID- the collection identifierobjectID- the object identifiervalue- data to be converted into JSONmessage- a message describing the contents of the notification
-
-
Method Details
-
getResult
Gets the result of the operation as a JSON string.- Returns:
- the result of the operation.
-
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.
-