Class BaseMessage

  • All Implemented Interfaces:
    java.lang.Cloneable
    Direct Known Subclasses:
    Message, PresenceMessage

    public class BaseMessage
    extends java.lang.Object
    implements java.lang.Cloneable
    • Field Summary

      Fields 
      Modifier and Type Field Description
      java.lang.String clientId
      The id of the publisher of this message
      java.lang.String connectionId
      The connection id of the publisher of this message
      java.lang.Object data
      The message payload.
      java.lang.String encoding
      Any transformation applied to the data for this message
      java.lang.String id
      A unique id for this message
      long timestamp
      The timestamp for this message
    • Constructor Summary

      Constructors 
      Constructor Description
      BaseMessage()  
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      protected int countFields()  
      void decode​(ChannelOptions opts)  
      void decode​(ChannelOptions opts, DecodingContext context)  
      void encode​(ChannelOptions opts)  
      void getDetails​(java.lang.StringBuilder builder)
      Generate a String summary of this BaseMessage.
      protected void read​(com.google.gson.JsonObject map)
      Populate fields from JSON.
      protected java.lang.Long readLong​(com.google.gson.JsonObject map, java.lang.String key)
      Read an optional numerical value.
      protected java.lang.String readString​(com.google.gson.JsonObject map, java.lang.String key)
      Read an optional textual value.
      static com.google.gson.JsonObject toJsonObject​(BaseMessage message)
      Base for gson serialisers.
      • Methods inherited from class java.lang.Object

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

      • id

        public java.lang.String id
        A unique id for this message
      • timestamp

        public long timestamp
        The timestamp for this message
      • clientId

        public java.lang.String clientId
        The id of the publisher of this message
      • connectionId

        public java.lang.String connectionId
        The connection id of the publisher of this message
      • encoding

        public java.lang.String encoding
        Any transformation applied to the data for this message
      • data

        public java.lang.Object data
        The message payload.
    • Constructor Detail

      • BaseMessage

        public BaseMessage()
    • Method Detail

      • getDetails

        public void getDetails​(java.lang.StringBuilder builder)
        Generate a String summary of this BaseMessage.
      • toJsonObject

        public static com.google.gson.JsonObject toJsonObject​(BaseMessage message)
        Base for gson serialisers.
      • readString

        protected java.lang.String readString​(com.google.gson.JsonObject map,
                                              java.lang.String key)
        Read an optional textual value.
        Returns:
        The value, or null if the key was not present in the map.
        Throws:
        java.lang.ClassCastException - if an element exists for that key and that element is not a JsonPrimitive or is not a valid string value.
      • readLong

        protected java.lang.Long readLong​(com.google.gson.JsonObject map,
                                          java.lang.String key)
        Read an optional numerical value.
        Returns:
        The value, or null if the key was not present in the map.
        Throws:
        java.lang.ClassCastException - if an element exists for that key and that element is not a JsonPrimitive or is not a valid long value.
      • countFields

        protected int countFields()