com.mooapi.common.command.client
Class MessageToServer<T extends AbstractMessage>

java.lang.Object
  extended by com.mooapi.common.command.client.AbstractClientCommand
      extended by com.mooapi.common.command.client.MessageToServer<T>
All Implemented Interfaces:
Command

public class MessageToServer<T extends AbstractMessage>
extends AbstractClientCommand

MooAPI message to server input command.

Author:
Steve Taylor

Constructor Summary
MessageToServer(T message, short subchannel)
          Create a new message to server input command.
 
Method Summary
static MessageToServer decode(org.apache.mina.common.ByteBuffer buffer, MessageCodec messageCodec)
          Create a new message to server input command from the data in the specified input buffer, using the specified codec to decode the message's text.
 org.apache.mina.common.ByteBuffer encode()
          Encode this command to a byte buffer.
 boolean equals(java.lang.Object obj)
           
 T getMessage()
          Get the message.
 short getSubchannel()
          Get the subchannel on which the message is sent.
 int hashCode()
           
 java.lang.String toString()
          Generate a string representation of this command.
 
Methods inherited from class com.mooapi.common.command.client.AbstractClientCommand
getType
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

MessageToServer

public MessageToServer(T message,
                       short subchannel)
Create a new message to server input command.

Parameters:
text - The message to send to the server.
subchannel - The subchannel on which to send the message.
Method Detail

decode

public static MessageToServer decode(org.apache.mina.common.ByteBuffer buffer,
                                     MessageCodec messageCodec)
Create a new message to server input command from the data in the specified input buffer, using the specified codec to decode the message's text.

Parameters:
buffer - An input buffer.
messageCodec - A message codec.
Returns:
A new message to server input command.
Throws:
java.nio.BufferUnderflowException - If the input buffer has insufficient bytes.

encode

public org.apache.mina.common.ByteBuffer encode()
Encode this command to a byte buffer.

Specified by:
encode in class AbstractClientCommand
Returns:
A buffer containing the encoded command.

getSubchannel

public short getSubchannel()
Get the subchannel on which the message is sent.

Returns:
The subchannel.

getMessage

public T getMessage()
Get the message.

Returns:
The message.

toString

public java.lang.String toString()
Generate a string representation of this command.

Specified by:
toString in class AbstractClientCommand
Returns:
This command's string representation.

equals

public boolean equals(java.lang.Object obj)
Specified by:
equals in class AbstractClientCommand
Parameters:
obj -
Returns:

hashCode

public int hashCode()
Specified by:
hashCode in class AbstractClientCommand
Returns:


Copyright © 2009. All Rights Reserved.