org.jogre.common.comm
Class CommBaseMessage

java.lang.Object
  extended byorg.jogre.common.comm.CommBaseMessage
All Implemented Interfaces:
ITransmittable
Direct Known Subclasses:
CommError, CommGameMessage, CommMasterServerConnect, CommMasterServerMessage

public abstract class CommBaseMessage
extends Object
implements ITransmittable

This is a base message which all communication objects should extend except the GameList and its children data classes. This includes a the username of the person who sent it and the status of the communication. The status codes should be defined in the sub class as a integer constant.

Version:
Alpha 0.2.1
Author:
Bob Marks

Field Summary
protected  int layer
          Layer that message belongs to.
protected  int status
          Integer status of this comm message.
protected  String username
          Username of person who sent this message.
static String XML_ATT_LAYER
          Type of message is used to determine which layer the message is for.
 
Constructor Summary
protected CommBaseMessage()
          Constructor with no parameters (no status).
protected CommBaseMessage(int status)
          Constructor which takes a username and a status.
protected CommBaseMessage(XMLElement message)
          Constructor which parses the XMLElement into class fields.
 
Method Summary
 XMLElement flatten(String name)
          Create a generic (nameless) XMLElement which sub classes can use.
 int getStatus()
          Return the status.
 String getUsername()
          Return the username.
 void setUsername(String username)
          Sets the username of the communication object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.jogre.common.comm.ITransmittable
flatten
 

Field Detail

username

protected String username
Username of person who sent this message.


status

protected int status
Integer status of this comm message.


layer

protected int layer
Layer that message belongs to.


XML_ATT_LAYER

public static final String XML_ATT_LAYER
Type of message is used to determine which layer the message is for.

See Also:
Constant Field Values
Constructor Detail

CommBaseMessage

protected CommBaseMessage()
Constructor with no parameters (no status).


CommBaseMessage

protected CommBaseMessage(int status)
Constructor which takes a username and a status.

Parameters:
status - A status

CommBaseMessage

protected CommBaseMessage(XMLElement message)
Constructor which parses the XMLElement into class fields.

Parameters:
message - Element to parse.
Method Detail

setUsername

public void setUsername(String username)
Sets the username of the communication object.

Parameters:
username - Username of sender communication object.

getUsername

public String getUsername()
Return the username.

Returns:
Username of user.

getStatus

public int getStatus()
Return the status.

Returns:
Status of user.

flatten

public XMLElement flatten(String name)
Create a generic (nameless) XMLElement which sub classes can use.

Parameters:
name - Name of the XML element.
Returns:
XML version of this class.