net.tomp2p.message
Class MessageID

java.lang.Object
  extended by net.tomp2p.message.MessageID
All Implemented Interfaces:
Comparable<MessageID>

public class MessageID
extends Object
implements Comparable<MessageID>

A message ID consists of the message id, which is created randomly and the nodeaddress. I'm not sure if we need this class with Netty... We'll see

Author:
Thomas Bocek

Constructor Summary
MessageID(Message message)
          Creates a message Id.
 
Method Summary
 int compareTo(MessageID o)
           
 boolean equals(Object obj)
           
 int getId()
          Returns the message Id
 PeerAddress getNodeAddress()
          The node address of sender or recipient
 int hashCode()
           
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

MessageID

public MessageID(Message message)
Creates a message Id. If the message is a request, the peer address is the sender, otherwise its the recipient. This is due to the fact that depending on the direction, peer address may change, but its still considered the same message.

Parameters:
message -
Method Detail

getId

public int getId()
Returns the message Id

Returns:
the message id

getNodeAddress

public PeerAddress getNodeAddress()
The node address of sender or recipient

Returns:
node address

compareTo

public int compareTo(MessageID o)
Specified by:
compareTo in interface Comparable<MessageID>

equals

public boolean equals(Object obj)
Overrides:
equals in class Object

hashCode

public int hashCode()
Overrides:
hashCode in class Object

toString

public String toString()
Overrides:
toString in class Object


Copyright © 2013. All Rights Reserved.