Class HashMapMessage

java.lang.Object
java.util.AbstractMap<K,​V>
java.util.HashMap<String,​Object>
org.cometd.common.HashMapMessage
All Implemented Interfaces:
Serializable, Cloneable, Map<String,​Object>, Message, Message.Mutable
Direct Known Subclasses:
ServerMessageImpl

public class HashMapMessage extends HashMap<String,​Object> implements Message.Mutable, Serializable
See Also:
Serialized Form
  • Constructor Details

    • HashMapMessage

      public HashMapMessage()
    • HashMapMessage

      public HashMapMessage(Message message)
  • Method Details

    • getAdvice

      public Map<String,​Object> getAdvice()
      Description copied from interface: Message
      Convenience method to retrieve the Message.ADVICE_FIELD
      Specified by:
      getAdvice in interface Message
      Returns:
      the advice of the message
    • getChannel

      public String getChannel()
      Description copied from interface: Message
      Convenience method to retrieve the Message.CHANNEL_FIELD. Bayeux message always have a non null channel.
      Specified by:
      getChannel in interface Message
      Returns:
      the channel of the message
    • getChannelId

      public ChannelId getChannelId()
      Description copied from interface: Message
      Convenience method to retrieve the Message.CHANNEL_FIELD. Bayeux message always have a non null channel.
      Specified by:
      getChannelId in interface Message
      Returns:
      the channel of the message
    • getClientId

      public String getClientId()
      Description copied from interface: Message
      Convenience method to retrieve the Message.CLIENT_ID_FIELD
      Specified by:
      getClientId in interface Message
      Returns:
      the client id of the message
    • getData

      public Object getData()
      Description copied from interface: Message
      Convenience method to retrieve the Message.DATA_FIELD
      Specified by:
      getData in interface Message
      Returns:
      the data of the message
      See Also:
      Message.getDataAsMap()
    • getDataAsMap

      public Map<String,​Object> getDataAsMap()
      Specified by:
      getDataAsMap in interface Message
      Returns:
      the data of the message as a map
      See Also:
      Message.getData()
    • getExt

      public Map<String,​Object> getExt()
      Description copied from interface: Message
      Convenience method to retrieve the Message.EXT_FIELD
      Specified by:
      getExt in interface Message
      Returns:
      the ext of the message
    • getId

      public String getId()
      Description copied from interface: Message
      Convenience method to retrieve the Message.ID_FIELD
      Specified by:
      getId in interface Message
      Returns:
      the id of the message
    • getAdvice

      public Map<String,​Object> getAdvice(boolean create)
      Description copied from interface: Message.Mutable
      Convenience method to retrieve the Message.ADVICE_FIELD and create it if it does not exist
      Specified by:
      getAdvice in interface Message.Mutable
      Parameters:
      create - whether to create the advice field if it does not exist
      Returns:
      the advice of the message
    • getDataAsMap

      public Map<String,​Object> getDataAsMap(boolean create)
      Description copied from interface: Message.Mutable
      Convenience method to retrieve the Message.DATA_FIELD and create it if it does not exist
      Specified by:
      getDataAsMap in interface Message.Mutable
      Parameters:
      create - whether to create the data field if it does not exist
      Returns:
      the data of the message
    • getExt

      public Map<String,​Object> getExt(boolean create)
      Description copied from interface: Message.Mutable
      Convenience method to retrieve the Message.EXT_FIELD and create it if it does not exist
      Specified by:
      getExt in interface Message.Mutable
      Parameters:
      create - whether to create the ext field if it does not exist
      Returns:
      the ext of the message
    • isMeta

      public boolean isMeta()
      Description copied from interface: Message
      A messages that has a meta channel is dubbed a "meta message".
      Specified by:
      isMeta in interface Message
      Returns:
      whether the channel's message is a meta channel
    • isPublishReply

      public boolean isPublishReply()
      Description copied from interface: Message
      Publish message replies contain the "successful" field
      Specified by:
      isPublishReply in interface Message
      Returns:
      whether this message is a publish reply (as opposed to a published message)
    • isSuccessful

      public boolean isSuccessful()
      Description copied from interface: Message
      Convenience method to retrieve the Message.SUCCESSFUL_FIELD
      Specified by:
      isSuccessful in interface Message
      Returns:
      whether the message is successful
    • setChannel

      public void setChannel(String channel)
      Specified by:
      setChannel in interface Message.Mutable
      Parameters:
      channel - the channel of this message
    • setClientId

      public void setClientId(String clientId)
      Specified by:
      setClientId in interface Message.Mutable
      Parameters:
      clientId - the client id of this message
    • setData

      public void setData(Object data)
      Specified by:
      setData in interface Message.Mutable
      Parameters:
      data - the data of this message
    • setId

      public void setId(String id)
      Specified by:
      setId in interface Message.Mutable
      Parameters:
      id - the id of this message
    • setSuccessful

      public void setSuccessful(boolean successful)
      Specified by:
      setSuccessful in interface Message.Mutable
      Parameters:
      successful - the successfulness of this message