com.mooapi.common.command.server
Class MessageFromConnection<T extends AbstractMessage>

java.lang.Object
  extended by com.mooapi.common.command.server.AbstractServerCommand
      extended by com.mooapi.common.command.server.MessageFromConnection<T>
All Implemented Interfaces:
Command
Direct Known Subclasses:
MessageFromServer

public class MessageFromConnection<T extends AbstractMessage>
extends AbstractServerCommand

MooAPI message output command.

Author:
Steve Taylor

Constructor Summary
MessageFromConnection(short subchannel, int channelId, int sourceConnectionId, T message)
          Initialize.
 
Method Summary
static MessageFromConnection decode(org.apache.mina.common.ByteBuffer buffer, MessageCodec messageCodec)
           
 org.apache.mina.common.ByteBuffer encode()
          Encode this command as a byte stream.
 boolean equals(java.lang.Object obj)
           
 int getChannelId()
          Get the ID of the channel to which the message is sent.
 T getMessage()
          Get the message
 int getSourceConnectionId()
          Get the connection ID of the message sender.
 short getSubchannel()
          Get the subchannel on which the message is sent.
 int hashCode()
           
 java.lang.String toString()
          Generate a string representation of this message.
 
Methods inherited from class com.mooapi.common.command.server.AbstractServerCommand
getType
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

MessageFromConnection

public MessageFromConnection(short subchannel,
                             int channelId,
                             int sourceConnectionId,
                             T message)
Initialize.

Parameters:
subchannel -
channelId -
sourceConnectionId -
message -
Method Detail

decode

public static MessageFromConnection decode(org.apache.mina.common.ByteBuffer buffer,
                                           MessageCodec messageCodec)
Parameters:
buffer -
Returns:

encode

public org.apache.mina.common.ByteBuffer encode()
Encode this command as a byte stream.

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

getSubchannel

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

Returns:
The subchannel.

getChannelId

public int getChannelId()
Get the ID of the channel to which the message is sent.

Returns:
The channel ID.

getSourceConnectionId

public int getSourceConnectionId()
Get the connection ID of the message sender.

Returns:
The sender's connection ID.

getMessage

public T getMessage()
Get the message

Returns:
The message.

toString

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

Specified by:
toString in class AbstractServerCommand
Returns:
A string representation of this message.

equals

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

hashCode

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


Copyright © 2009. All Rights Reserved.