mhframework.net
Class MHNetworkMessage

java.lang.Object
  extended by mhframework.net.MHNetworkMessage
All Implemented Interfaces:
java.io.Serializable

public class MHNetworkMessage
extends java.lang.Object
implements java.io.Serializable

Provides a standard structure for network communication for a client/server app powered by MHFramework.

See Also:
Serialized Form

Constructor Summary
MHNetworkMessage()
          Constructor.
MHNetworkMessage(java.lang.String msgType, java.io.Serializable payloadObject)
          Constructor.
 
Method Summary
 java.lang.String getMessageType()
           
 java.io.Serializable getPayload()
           
 void setMessageType(java.lang.String messageType)
           
 void setPayload(java.io.Serializable payload)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MHNetworkMessage

public MHNetworkMessage()
Constructor. Creates a default network message of type CHAT with a payload of "No payload specified."


MHNetworkMessage

public MHNetworkMessage(java.lang.String msgType,
                        java.io.Serializable payloadObject)
Constructor. Creates a network message of the type specified by msgType with a payload specified by payloadObject.

Parameters:
msgType - A string indicating what type of message this is. The default engine messages defined in MHMessageType will be handled by the MHServerModule class. Other message types will be delegated to the game-specific class implementing the MHGameServer interface.
payloadObject - The object carrying the execution details for the message. For a chat, this is the message string; for a player name registration, this is the player's name; for a client list broadcast, this is the the client list object; and so on.
Method Detail

getMessageType

public java.lang.String getMessageType()

setMessageType

public void setMessageType(java.lang.String messageType)

getPayload

public java.io.Serializable getPayload()

setPayload

public void setPayload(java.io.Serializable payload)