Package org.cometd.common
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
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class java.util.AbstractMap
AbstractMap.SimpleEntry<K extends Object,V extends Object>, AbstractMap.SimpleImmutableEntry<K extends Object,V extends Object>
-
Nested classes/interfaces inherited from interface java.util.Map
Map.Entry<K extends Object,V extends Object>
-
Nested classes/interfaces inherited from interface org.cometd.bayeux.Message
Message.Mutable
-
-
Field Summary
-
Fields inherited from interface org.cometd.bayeux.Message
ADVICE_FIELD, CHANNEL_FIELD, CLIENT_ID_FIELD, CONNECTION_TYPE_FIELD, DATA_FIELD, ERROR_FIELD, EXT_FIELD, ID_FIELD, INTERVAL_FIELD, MAX_INTERVAL_FIELD, MIN_VERSION_FIELD, RECONNECT_FIELD, RECONNECT_HANDSHAKE_VALUE, RECONNECT_NONE_VALUE, RECONNECT_RETRY_VALUE, SUBSCRIPTION_FIELD, SUCCESSFUL_FIELD, SUPPORTED_CONNECTION_TYPES_FIELD, TIMEOUT_FIELD, TIMESTAMP_FIELD, TRANSPORT_FIELD, VERSION_FIELD
-
-
Constructor Summary
Constructors Constructor Description HashMapMessage()
HashMapMessage(Message message)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Map<String,Object>
getAdvice()
Convenience method to retrieve theMessage.ADVICE_FIELD
Map<String,Object>
getAdvice(boolean create)
Convenience method to retrieve theMessage.ADVICE_FIELD
and create it if it does not existString
getChannel()
Convenience method to retrieve theMessage.CHANNEL_FIELD
.ChannelId
getChannelId()
Convenience method to retrieve theMessage.CHANNEL_FIELD
.String
getClientId()
Convenience method to retrieve theMessage.CLIENT_ID_FIELD
Object
getData()
Convenience method to retrieve theMessage.DATA_FIELD
Map<String,Object>
getDataAsMap()
Map<String,Object>
getDataAsMap(boolean create)
Convenience method to retrieve theMessage.DATA_FIELD
and create it if it does not existMap<String,Object>
getExt()
Convenience method to retrieve theMessage.EXT_FIELD
Map<String,Object>
getExt(boolean create)
Convenience method to retrieve theMessage.EXT_FIELD
and create it if it does not existString
getId()
Convenience method to retrieve theMessage.ID_FIELD
String
getJSON()
boolean
isMeta()
A messages that has a meta channel is dubbed a "meta message".boolean
isPublishReply()
Publish message replies contain the "successful" fieldboolean
isSuccessful()
Convenience method to retrieve theMessage.SUCCESSFUL_FIELD
void
setChannel(String channel)
void
setClientId(String clientId)
void
setData(Object data)
void
setId(String id)
void
setSuccessful(boolean successful)
-
Methods inherited from class java.util.HashMap
clear, clone, compute, computeIfAbsent, computeIfPresent, containsKey, containsValue, entrySet, forEach, get, getOrDefault, isEmpty, keySet, merge, put, putAll, putIfAbsent, remove, remove, replace, replace, replaceAll, size, values
-
Methods inherited from class java.util.AbstractMap
equals, hashCode, toString
-
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface java.util.Map
clear, compute, computeIfAbsent, computeIfPresent, containsKey, containsValue, entrySet, equals, forEach, get, getOrDefault, hashCode, isEmpty, keySet, merge, put, putAll, putIfAbsent, remove, remove, replace, replace, replaceAll, size, values
-
-
-
-
Constructor Detail
-
HashMapMessage
public HashMapMessage()
-
HashMapMessage
public HashMapMessage(Message message)
-
-
Method Detail
-
getAdvice
public Map<String,Object> getAdvice()
Description copied from interface:Message
Convenience method to retrieve theMessage.ADVICE_FIELD
-
getChannel
public String getChannel()
Description copied from interface:Message
Convenience method to retrieve theMessage.CHANNEL_FIELD
. Bayeux message always have a non null channel.- Specified by:
getChannel
in interfaceMessage
- Returns:
- the channel of the message
-
getChannelId
public ChannelId getChannelId()
Description copied from interface:Message
Convenience method to retrieve theMessage.CHANNEL_FIELD
. Bayeux message always have a non null channel.- Specified by:
getChannelId
in interfaceMessage
- Returns:
- the channel of the message
-
getClientId
public String getClientId()
Description copied from interface:Message
Convenience method to retrieve theMessage.CLIENT_ID_FIELD
- Specified by:
getClientId
in interfaceMessage
- Returns:
- the client id of the message
-
getData
public Object getData()
Description copied from interface:Message
Convenience method to retrieve theMessage.DATA_FIELD
- Specified by:
getData
in interfaceMessage
- Returns:
- the data of the message
- See Also:
Message.getDataAsMap()
-
getDataAsMap
public Map<String,Object> getDataAsMap()
- Specified by:
getDataAsMap
in interfaceMessage
- 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 theMessage.EXT_FIELD
-
getId
public String getId()
Description copied from interface:Message
Convenience method to retrieve theMessage.ID_FIELD
-
getJSON
public String getJSON()
-
getAdvice
public Map<String,Object> getAdvice(boolean create)
Description copied from interface:Message.Mutable
Convenience method to retrieve theMessage.ADVICE_FIELD
and create it if it does not exist- Specified by:
getAdvice
in interfaceMessage.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 theMessage.DATA_FIELD
and create it if it does not exist- Specified by:
getDataAsMap
in interfaceMessage.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 theMessage.EXT_FIELD
and create it if it does not exist- Specified by:
getExt
in interfaceMessage.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".
-
isPublishReply
public boolean isPublishReply()
Description copied from interface:Message
Publish message replies contain the "successful" field- Specified by:
isPublishReply
in interfaceMessage
- 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 theMessage.SUCCESSFUL_FIELD
- Specified by:
isSuccessful
in interfaceMessage
- Returns:
- whether the message is successful
-
setChannel
public void setChannel(String channel)
- Specified by:
setChannel
in interfaceMessage.Mutable
- Parameters:
channel
- the channel of this message
-
setClientId
public void setClientId(String clientId)
- Specified by:
setClientId
in interfaceMessage.Mutable
- Parameters:
clientId
- the client id of this message
-
setData
public void setData(Object data)
- Specified by:
setData
in interfaceMessage.Mutable
- Parameters:
data
- the data of this message
-
setId
public void setId(String id)
- Specified by:
setId
in interfaceMessage.Mutable
- Parameters:
id
- the id of this message
-
setSuccessful
public void setSuccessful(boolean successful)
- Specified by:
setSuccessful
in interfaceMessage.Mutable
- Parameters:
successful
- the successfulness of this message
-
-