KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > freeforums > message > ReadMessagePK


1 /*
2  * ReadMessageUserPK.java
3  *
4  * Defines a composite Primary Key for Read Messages
5  *
6  * @author: Devraj Mukherjee
7  *
8  * Created: 23rd June 2001
9  *
10  */

11
12  package freeforums.message;
13
14  import java.io.Serializable JavaDoc;
15
16  public class ReadMessagePK implements Serializable JavaDoc {
17
18      public String JavaDoc userName;
19      public Integer JavaDoc messageID;
20
21      public ReadMessagePK() { }
22
23      public ReadMessagePK(String JavaDoc userName, Integer JavaDoc messageID) {
24
25          this.userName = userName;
26          this.messageID = messageID;
27
28      }
29
30      public boolean equals(Object JavaDoc obj) {
31
32          if (obj==null || !(obj instanceof ReadMessagePK)) return false;
33
34          if ((((ReadMessagePK)obj).userName == this.userName) && (((ReadMessagePK)obj).messageID == this.messageID))
35           return true;
36
37          return false; //default value that will be returned
38

39      }
40
41      public int hashCode() { return messageID.intValue(); }
42
43      public String JavaDoc toString() { return userName + " " + messageID; }
44  }
45
Popular Tags