KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > freeforums > user > ForumUserPK


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

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

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