dip.net.message
Class MID

java.lang.Object
  extended bydip.net.message.MID

public class MID
extends java.lang.Object

An Message Identifier, which identifies a sender or recipient of a message. An optional nickname (defaults to name if not specified) may also be set.

A player is identified by having the Power attribute set. A non-player does not have the Power set.

No security is attempted here. It is up to the underlying Channel to ensure (by extending this class, if required) that MIDs are valid. Specifically, ensuring that Player MIDs cannot be faked by non-players or other players.


Field Summary
static MID ANONYMOUS
          Anonymous sender (TODO: needs i18n)
 
Constructor Summary
MID(Power power, java.lang.String name)
          Create an MID
MID(java.lang.String nick, java.lang.String name)
          Create an MID
 
Method Summary
 boolean equals(java.lang.Object obj)
          Compare two MIDs for equality (of all fields)
 java.lang.String getName()
          Get the name (which may be null) associated with the ID
 java.lang.String getNick()
          Get the nickname.
 java.lang.String getNickAndName()
          Prints nick, and if set, name.
 Power getPower()
          Get the Power (or null, if unknown or not applicable) associated with the ID
 int hashCode()
          Hashcode implementation
 boolean isPlayer()
          Determine if this MID belongs to a player or not.
 java.lang.String toString()
          Equivalent to getNickAndName()
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

ANONYMOUS

public static final MID ANONYMOUS
Anonymous sender (TODO: needs i18n)

Constructor Detail

MID

public MID(java.lang.String nick,
           java.lang.String name)
Create an MID


MID

public MID(Power power,
           java.lang.String name)
Create an MID

Method Detail

getPower

public final Power getPower()
Get the Power (or null, if unknown or not applicable) associated with the ID


getName

public java.lang.String getName()
Get the name (which may be null) associated with the ID


getNick

public java.lang.String getNick()
Get the nickname. (never null).


isPlayer

public boolean isPlayer()
Determine if this MID belongs to a player or not.


getNickAndName

public java.lang.String getNickAndName()
Prints nick, and if set, name.


toString

public java.lang.String toString()
Equivalent to getNickAndName()


equals

public boolean equals(java.lang.Object obj)
Compare two MIDs for equality (of all fields)


hashCode

public int hashCode()
Hashcode implementation



Copyright 2002-2004 Zachary DelProposto / jDip Development Team. All Rights Reserved.