de.enough.polish.android.messaging
Class MessageImpl

java.lang.Object
  extended by de.enough.polish.android.messaging.MessageImpl
All Implemented Interfaces:
Message
Direct Known Subclasses:
BinaryMessageImpl, TextMessageImpl

public class MessageImpl
extends Object
implements Message

Provides basic Message implementation.


Field Summary
protected  String address
           
protected  Date timestamp
           
 
Constructor Summary
MessageImpl(String address, Date timestamp)
           
 
Method Summary
 String getAddress()
          Returns the address associated with this message.
 Date getTimestamp()
          Returns the timestamp indicating when this message has been sent.
 void setAddress(String addr)
          Sets the address associated with this message, that is, the address returned by the getAddress method.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

address

protected String address

timestamp

protected Date timestamp
Constructor Detail

MessageImpl

public MessageImpl(String address,
                   Date timestamp)
Method Detail

getTimestamp

public Date getTimestamp()
Description copied from interface: Message
Returns the timestamp indicating when this message has been sent.

Specified by:
getTimestamp in interface Message
Returns:
Date indicating the timestamp in the message or null if the timestamp is not set or if the time information is not available in the underlying protocol message

getAddress

public String getAddress()
Description copied from interface: Message
Returns the address associated with this message.

If this is a message to be sent, then this address is the recipient's address.

If this is a message that has been received, then this address is the sender's address.

Returns null, if the address for the message is not set.

Note: This design allows responses to be sent to a received message by reusing the same Message object and just replacing the payload. The address field can normally be kept untouched (unless the messaging protocol requires some special handling of the address).

Specified by:
getAddress in interface Message
Returns:
the address of this message, or null if the address is not set
See Also:
Message.setAddress(String)

setAddress

public void setAddress(String addr)
Description copied from interface: Message
Sets the address associated with this message, that is, the address returned by the getAddress method. The address may be set to null.

Specified by:
setAddress in interface Message
Parameters:
addr - - address for the message
See Also:
Message.getAddress()