Package co.arago.hiro.client.model
Class HiroMessage
- java.lang.Object
-
- co.arago.hiro.client.model.HiroJsonMap
-
- co.arago.hiro.client.model.HiroMessage
-
- All Implemented Interfaces:
JsonMessage,ToMap,java.io.Serializable
- Direct Known Subclasses:
HiroItemListMessage,HiroTimeseriesListMessage.TimeseriesEntry,HiroVertexMessage,TokenResponse,VersionResponse
public class HiroMessage extends HiroJsonMap
This contains a LinkedHashMap<String, Object>HiroJsonMap.fieldsMap(fromHiroJsonMapfor the generic incoming data.This class is meant to parse HTTP responses and WebSocket messages received from HIRO.
{ "key": [any value] ... }- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected HiroErrorhiroError-
Fields inherited from class co.arago.hiro.client.model.HiroJsonMap
fieldsMap
-
-
Constructor Summary
Constructors Constructor Description HiroMessage()Default constructor for JacksonHiroMessage(java.util.Map<java.lang.String,java.lang.Object> initialData)Constructor
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected booleancatchError(java.lang.String key, java.lang.Object value)If the key is "error", createhiroErrorfrom the value.HiroErrorgetError()Gets the received error in the response.booleanisError()Checks for a received error.voidsetField(java.lang.String key, java.lang.Object value)Set the field inHiroJsonMap.fieldsMapunless an error message is found viacatchError(String, Object).-
Methods inherited from class co.arago.hiro.client.model.HiroJsonMap
addFields, getField, getMap, getUnmappedField, setFields, toMap
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface co.arago.hiro.client.model.JsonMessage
toJsonString, toJsonStringNoNull, toPrettyJsonString, toPrettyJsonStringNoNull
-
-
-
-
Field Detail
-
hiroError
protected HiroError hiroError
-
-
Method Detail
-
setField
public void setField(java.lang.String key, java.lang.Object value)Set the field inHiroJsonMap.fieldsMapunless an error message is found viacatchError(String, Object).- Overrides:
setFieldin classHiroJsonMap- Parameters:
key- The name of the field.value- The value of the field.
-
catchError
protected boolean catchError(java.lang.String key, java.lang.Object value)If the key is "error", createhiroErrorfrom the value.- Parameters:
key- The name of the field.value- The value of the field.- Returns:
- true if an error was found (key is "error"), false otherwise.
-
isError
public boolean isError()
Checks for a received error.- Returns:
- true or false
-
getError
public HiroError getError()
Gets the received error in the response.- Returns:
- The HiroErrorResponse or null if no error is present.
-
-