Package org.cometd.common
Class HashMapMessage
- java.lang.Object
-
- java.util.AbstractMap<K,V>
-
- java.util.HashMap<java.lang.String,java.lang.Object>
-
- org.cometd.common.HashMapMessage
-
- All Implemented Interfaces:
java.io.Serializable,java.lang.Cloneable,java.util.Map<java.lang.String,java.lang.Object>,Message,Message.Mutable
- Direct Known Subclasses:
ServerMessageImpl
public class HashMapMessage extends java.util.HashMap<java.lang.String,java.lang.Object> implements Message.Mutable, java.io.Serializable
- See Also:
- Serialized Form
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class java.util.AbstractMap
java.util.AbstractMap.SimpleEntry<K extends java.lang.Object,V extends java.lang.Object>, java.util.AbstractMap.SimpleImmutableEntry<K extends java.lang.Object,V extends java.lang.Object>
-
Nested classes/interfaces inherited from interface java.util.Map
java.util.Map.Entry<K extends java.lang.Object,V extends java.lang.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 java.util.Map<java.lang.String,java.lang.Object>getAdvice()Convenience method to retrieve theMessage.ADVICE_FIELDjava.util.Map<java.lang.String,java.lang.Object>getAdvice(boolean create)Convenience method to retrieve theMessage.ADVICE_FIELDand create it if it does not existjava.lang.StringgetChannel()Convenience method to retrieve theMessage.CHANNEL_FIELD.ChannelIdgetChannelId()Convenience method to retrieve theMessage.CHANNEL_FIELD.java.lang.StringgetClientId()Convenience method to retrieve theMessage.CLIENT_ID_FIELDjava.lang.ObjectgetData()Convenience method to retrieve theMessage.DATA_FIELDjava.util.Map<java.lang.String,java.lang.Object>getDataAsMap()java.util.Map<java.lang.String,java.lang.Object>getDataAsMap(boolean create)Convenience method to retrieve theMessage.DATA_FIELDand create it if it does not existjava.util.Map<java.lang.String,java.lang.Object>getExt()Convenience method to retrieve theMessage.EXT_FIELDjava.util.Map<java.lang.String,java.lang.Object>getExt(boolean create)Convenience method to retrieve theMessage.EXT_FIELDand create it if it does not existjava.lang.StringgetId()Convenience method to retrieve theMessage.ID_FIELDbooleanisMeta()A messages that has a meta channel is dubbed a "meta message".booleanisPublishReply()Publish message replies contain the "successful" fieldbooleanisSuccessful()Convenience method to retrieve theMessage.SUCCESSFUL_FIELDvoidsetChannel(java.lang.String channel)voidsetClientId(java.lang.String clientId)voidsetData(java.lang.Object data)voidsetId(java.lang.String id)voidsetSuccessful(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
-
-
-
-
Constructor Detail
-
HashMapMessage
public HashMapMessage()
-
HashMapMessage
public HashMapMessage(Message message)
-
-
Method Detail
-
getAdvice
public java.util.Map<java.lang.String,java.lang.Object> getAdvice()
Description copied from interface:MessageConvenience method to retrieve theMessage.ADVICE_FIELD
-
getChannel
public java.lang.String getChannel()
Description copied from interface:MessageConvenience method to retrieve theMessage.CHANNEL_FIELD. Bayeux message always have a non null channel.- Specified by:
getChannelin interfaceMessage- Returns:
- the channel of the message
-
getChannelId
public ChannelId getChannelId()
Description copied from interface:MessageConvenience method to retrieve theMessage.CHANNEL_FIELD. Bayeux message always have a non null channel.- Specified by:
getChannelIdin interfaceMessage- Returns:
- the channel of the message
-
getClientId
public java.lang.String getClientId()
Description copied from interface:MessageConvenience method to retrieve theMessage.CLIENT_ID_FIELD- Specified by:
getClientIdin interfaceMessage- Returns:
- the client id of the message
-
getData
public java.lang.Object getData()
Description copied from interface:MessageConvenience method to retrieve theMessage.DATA_FIELD- Specified by:
getDatain interfaceMessage- Returns:
- the data of the message
- See Also:
Message.getDataAsMap()
-
getDataAsMap
public java.util.Map<java.lang.String,java.lang.Object> getDataAsMap()
- Specified by:
getDataAsMapin interfaceMessage- Returns:
- the data of the message as a map
- See Also:
Message.getData()
-
getExt
public java.util.Map<java.lang.String,java.lang.Object> getExt()
Description copied from interface:MessageConvenience method to retrieve theMessage.EXT_FIELD
-
getId
public java.lang.String getId()
Description copied from interface:MessageConvenience method to retrieve theMessage.ID_FIELD
-
getAdvice
public java.util.Map<java.lang.String,java.lang.Object> getAdvice(boolean create)
Description copied from interface:Message.MutableConvenience method to retrieve theMessage.ADVICE_FIELDand create it if it does not exist- Specified by:
getAdvicein interfaceMessage.Mutable- Parameters:
create- whether to create the advice field if it does not exist- Returns:
- the advice of the message
-
getDataAsMap
public java.util.Map<java.lang.String,java.lang.Object> getDataAsMap(boolean create)
Description copied from interface:Message.MutableConvenience method to retrieve theMessage.DATA_FIELDand create it if it does not exist- Specified by:
getDataAsMapin interfaceMessage.Mutable- Parameters:
create- whether to create the data field if it does not exist- Returns:
- the data of the message
-
getExt
public java.util.Map<java.lang.String,java.lang.Object> getExt(boolean create)
Description copied from interface:Message.MutableConvenience method to retrieve theMessage.EXT_FIELDand create it if it does not exist- Specified by:
getExtin 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:MessageA messages that has a meta channel is dubbed a "meta message".
-
isPublishReply
public boolean isPublishReply()
Description copied from interface:MessagePublish message replies contain the "successful" field- Specified by:
isPublishReplyin interfaceMessage- Returns:
- whether this message is a publish reply (as opposed to a published message)
-
isSuccessful
public boolean isSuccessful()
Description copied from interface:MessageConvenience method to retrieve theMessage.SUCCESSFUL_FIELD- Specified by:
isSuccessfulin interfaceMessage- Returns:
- whether the message is successful
-
setChannel
public void setChannel(java.lang.String channel)
- Specified by:
setChannelin interfaceMessage.Mutable- Parameters:
channel- the channel of this message
-
setClientId
public void setClientId(java.lang.String clientId)
- Specified by:
setClientIdin interfaceMessage.Mutable- Parameters:
clientId- the client id of this message
-
setData
public void setData(java.lang.Object data)
- Specified by:
setDatain interfaceMessage.Mutable- Parameters:
data- the data of this message
-
setId
public void setId(java.lang.String id)
- Specified by:
setIdin interfaceMessage.Mutable- Parameters:
id- the id of this message
-
setSuccessful
public void setSuccessful(boolean successful)
- Specified by:
setSuccessfulin interfaceMessage.Mutable- Parameters:
successful- the successfulness of this message
-
-