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

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

public class MessageToConnection<T extends AbstractMessage>
extends AbstractClientCommand

MooAPI message to user input command.

Author:
Steve Taylor

Constructor Summary
MessageToConnection(T message, int connectionId, int channelId, short subchannel)
          Create a new message to user input command.
 
Method Summary
static MessageToConnection decode(org.apache.mina.common.ByteBuffer buffer, MessageCodec messageCodec)
          Create a new message to user 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)
           
 int getChannelId()
          Get the destination channel ID.
 int getConnectionId()
          Get the destination connection ID.
 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

MessageToConnection

public MessageToConnection(T message,
                           int connectionId,
                           int channelId,
                           short subchannel)
Create a new message to user input command.

Parameters:
text - The message text.
connectionId - The destination's connection ID.
channelId - The destination's channel ID.
subchannel - The subchannel on which the message is sent.
Method Detail

decode

public static MessageToConnection decode(org.apache.mina.common.ByteBuffer buffer,
                                         MessageCodec messageCodec)
Create a new message to user 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 user 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.

getConnectionId

public int getConnectionId()
Get the destination connection ID.

Returns:
The connection ID.

getChannelId

public int getChannelId()
Get the destination channel ID.

Returns:
The channel ID.

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.