org.cometd
Interface Message

All Superinterfaces:
java.lang.Cloneable, java.util.Map<java.lang.String,java.lang.Object>

public interface Message
extends java.util.Map<java.lang.String,java.lang.Object>, java.lang.Cloneable

A Bayeux Message. A Map of String to Object that has been optimized for conversion to JSON messages. Even if this class implements Cloneable, it is not supported to deep clone a message (mostly due to the fact that Object.clone() is broken in Java).


Nested Class Summary
 
Nested classes/interfaces inherited from interface java.util.Map
java.util.Map.Entry<K,V>
 
Method Summary
 java.lang.Object clone()
          Deprecated. If you want a deep copy of a message, consider instantiating a new message object and populating it with deep copies of the fields of this message. A quicker alternative in case the fields of the messages are not known a priori or not easily deep copyable, is to convert this message to JSON and then back to a Message, functionality that is present in the Bayeux implementation.
 Message getAssociated()
          When this message represent a response to a request message, this method returns the request message.
 java.lang.String getChannel()
          Convenience method for message.get(Bayeux.CHANNEL_FIELD).
 java.lang.String getClientId()
          Convenience method for message.get(Bayeux.CLIENT_FIELD).
 java.lang.Object getData()
          Convenience method for message.get(Bayeux.DATA_FIELD).
 java.util.Map<java.lang.String,java.lang.Object> getExt(boolean create)
          Returns the ext field of this message, optionally creating it.
 java.lang.String getId()
          Convenience method for message.get(Bayeux.ID_FIELD).
 
Methods inherited from interface java.util.Map
clear, containsKey, containsValue, entrySet, equals, get, hashCode, isEmpty, keySet, put, putAll, remove, size, values
 

Method Detail

getClientId

java.lang.String getClientId()
Convenience method for message.get(Bayeux.CLIENT_FIELD).

Returns:
The clientId field of this message

getChannel

java.lang.String getChannel()
Convenience method for message.get(Bayeux.CHANNEL_FIELD).

Returns:
The channel field of this message

getId

java.lang.String getId()
Convenience method for message.get(Bayeux.ID_FIELD).

Returns:
The id field of this message

getData

java.lang.Object getData()
Convenience method for message.get(Bayeux.DATA_FIELD).

Returns:
The data field of this message

getExt

java.util.Map<java.lang.String,java.lang.Object> getExt(boolean create)
Returns the ext field of this message, optionally creating it.

Parameters:
create - whether the ext field should be created if it is absent.
Returns:
The ext field of this message

getAssociated

Message getAssociated()
When this message represent a response to a request message, this method returns the request message.

Returns:
The message associated with this message

clone

@Deprecated
java.lang.Object clone()
Deprecated. If you want a deep copy of a message, consider instantiating a new message object and populating it with deep copies of the fields of this message. A quicker alternative in case the fields of the messages are not known a priori or not easily deep copyable, is to convert this message to JSON and then back to a Message, functionality that is present in the Bayeux implementation.

Returns:
A shallow copy of this message.


Copyright © 2008-2010 Dojo Foundation. All Rights Reserved.