Class AbstractMessage

java.lang.Object
host.anzo.simon.codec.messages.AbstractMessage
All Implemented Interfaces:
Serializable
Direct Known Subclasses:
MsgCloseRawChannel, MsgCloseRawChannelReturn, MsgEquals, MsgEqualsReturn, MsgError, MsgHashCode, MsgHashCodeReturn, MsgInterfaceLookup, MsgInterfaceLookupReturn, MsgInvoke, MsgInvokeReturn, MsgNameLookup, MsgNameLookupReturn, MsgOpenRawChannel, MsgOpenRawChannelReturn, MsgPing, MsgPong, MsgRawChannelData, MsgRawChannelDataReturn, MsgReleaseRef, MsgToString, MsgToStringReturn

public abstract class AbstractMessage extends Object implements Serializable
A base message for SIMON protocol messages. Error messages are not being sent via the errorMsg field: In case of a problems reading a message, the responsible decoder class will inject the error message, so that the ProcessMessageRunnable can react on that error accordingly.
See Also:
  • Constructor Details

    • AbstractMessage

      protected AbstractMessage(byte msgType)
      Creates a new message decoder
      Parameters:
      msgType - specifies a unique ID for the type of message
  • Method Details

    • getErrorMsg

      public String getErrorMsg()
      Returns the error message. Contains Statics.NO_ERROR if no error is present.
      Returns:
      the errorMsg
    • setErrorMsg

      public void setErrorMsg(String errorMsg)
      Sets the error message related to this message
      Parameters:
      errorMsg - the errorMsg to set
    • hasError

      public boolean hasError()
      Returns whether this message has an error or not
      Returns:
      true, if error is present, false if not
    • getMsgType

      public byte getMsgType()
      Returns the message type as described by SimonMessageConstants
      Returns:
      the msgType
    • getSequence

      public int getSequence()
      Returns, guess what, the sequence id of the message
      Returns:
      the sequence
    • setSequence

      public void setSequence(int sequence)
      Stores the sequence id in the message
      Parameters:
      sequence - the sequence to set