anon.util
Class AbstractMessage

java.lang.Object
  extended by anon.util.AbstractMessage
Direct Known Subclasses:
DatabaseMessage, InfoServiceHolderMessage

public abstract class AbstractMessage
extends java.lang.Object

This is a generic message implementation. Messages normally are used by observed objects when calling the update() method of the observers (but there are also other usage scenarios possible). Thus it is possible to send the reason for the update() call. Messages have a message code containing the reason for the update. Also there is the possibility to append an Object to the message with more detailed information. The message codes and the usage of the appended object are defined within the children of this class.


Field Summary
private  int m_messageCode
          Stores the message code.
private  java.lang.Object m_messageData
          Stores some message data, which maybe was sent with the message.
 
Constructor Summary
protected AbstractMessage(int a_messageCode)
          This creates a new AbstractMessage.
protected AbstractMessage(int a_messageCode, java.lang.Object a_messageData)
          This creates a new AbstractMessage.
 
Method Summary
 int getMessageCode()
          This returns the message code of this message.
 java.lang.Object getMessageData()
          Returns the message data, which was sent with the message.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

m_messageCode

private int m_messageCode
Stores the message code.


m_messageData

private java.lang.Object m_messageData
Stores some message data, which maybe was sent with the message.

Constructor Detail

AbstractMessage

protected AbstractMessage(int a_messageCode)
This creates a new AbstractMessage. The message data is set to null.

Parameters:
a_messageCode - The message code.

AbstractMessage

protected AbstractMessage(int a_messageCode,
                          java.lang.Object a_messageData)
This creates a new AbstractMessage.

Parameters:
a_messageCode - The message code.
a_messageData - The data to send with the message.
Method Detail

getMessageCode

public int getMessageCode()
This returns the message code of this message.

Returns:
The message code.

getMessageData

public java.lang.Object getMessageData()
Returns the message data, which was sent with the message. If there was no data sent with the message, null is returned.

Returns:
The message data.