KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jboss > test > cmp2 > fkmapping > ejb > StudentPK


1 /*
2  * Generated by XDoclet - Do not edit!
3  */

4 package org.jboss.test.cmp2.fkmapping.ejb;
5
6 /**
7  * Primary key for Student.
8  */

9 public class StudentPK
10    extends java.lang.Object JavaDoc
11    implements java.io.Serializable JavaDoc
12 {
13    private int _hashCode = 0;
14    private StringBuffer JavaDoc _toStringValue = null;
15
16    public java.lang.String JavaDoc departmentCode;
17    public java.lang.String JavaDoc departmentCode2;
18    public java.lang.String JavaDoc lastName;
19
20    public StudentPK()
21    {
22    }
23
24    public StudentPK( java.lang.String JavaDoc departmentCode,java.lang.String JavaDoc departmentCode2,java.lang.String JavaDoc lastName )
25    {
26       this.departmentCode = departmentCode;
27       this.departmentCode2 = departmentCode2;
28       this.lastName = lastName;
29    }
30
31    public java.lang.String JavaDoc getDepartmentCode()
32    {
33       return departmentCode;
34    }
35    public java.lang.String JavaDoc getDepartmentCode2()
36    {
37       return departmentCode2;
38    }
39    public java.lang.String JavaDoc getLastName()
40    {
41       return lastName;
42    }
43
44    public void setDepartmentCode(java.lang.String JavaDoc departmentCode)
45    {
46       this.departmentCode = departmentCode;
47       _hashCode = 0;
48    }
49    public void setDepartmentCode2(java.lang.String JavaDoc departmentCode2)
50    {
51       this.departmentCode2 = departmentCode2;
52       _hashCode = 0;
53    }
54    public void setLastName(java.lang.String JavaDoc lastName)
55    {
56       this.lastName = lastName;
57       _hashCode = 0;
58    }
59
60    public int hashCode()
61    {
62       if( _hashCode == 0 )
63       {
64          if (this.departmentCode != null) _hashCode += this.departmentCode.hashCode();
65          if (this.departmentCode2 != null) _hashCode += this.departmentCode2.hashCode();
66          if (this.lastName != null) _hashCode += this.lastName.hashCode();
67       }
68
69       return _hashCode;
70    }
71
72    public boolean equals(Object JavaDoc obj)
73    {
74       if( !(obj instanceof org.jboss.test.cmp2.fkmapping.ejb.StudentPK) )
75          return false;
76
77       org.jboss.test.cmp2.fkmapping.ejb.StudentPK pk = (org.jboss.test.cmp2.fkmapping.ejb.StudentPK)obj;
78       boolean eq = true;
79
80       if( obj == null )
81       {
82          eq = false;
83       }
84       else
85       {
86          if( this.departmentCode == null && ((org.jboss.test.cmp2.fkmapping.ejb.StudentPK)obj).getDepartmentCode() == null )
87          {
88             eq = true;
89          }
90          else
91          {
92             if( this.departmentCode == null || ((org.jboss.test.cmp2.fkmapping.ejb.StudentPK)obj).getDepartmentCode() == null )
93             {
94                eq = false;
95             }
96             else
97             {
98                eq = eq && this.departmentCode.equals( pk.departmentCode );
99             }
100          }
101          if( this.departmentCode2 == null && ((org.jboss.test.cmp2.fkmapping.ejb.StudentPK)obj).getDepartmentCode2() == null )
102          {
103             eq = true;
104          }
105          else
106          {
107             if( this.departmentCode2 == null || ((org.jboss.test.cmp2.fkmapping.ejb.StudentPK)obj).getDepartmentCode2() == null )
108             {
109                eq = false;
110             }
111             else
112             {
113                eq = eq && this.departmentCode2.equals( pk.departmentCode2 );
114             }
115          }
116          if( this.lastName == null && ((org.jboss.test.cmp2.fkmapping.ejb.StudentPK)obj).getLastName() == null )
117          {
118             eq = true;
119          }
120          else
121          {
122             if( this.lastName == null || ((org.jboss.test.cmp2.fkmapping.ejb.StudentPK)obj).getLastName() == null )
123             {
124                eq = false;
125             }
126             else
127             {
128                eq = eq && this.lastName.equals( pk.lastName );
129             }
130          }
131       }
132
133       return eq;
134    }
135
136    /** @return String representation of this pk in the form of [.field1.field2.field3]. */
137    public String JavaDoc toString()
138    {
139       if( _toStringValue == null )
140       {
141          _toStringValue = new StringBuffer JavaDoc("[.");
142          _toStringValue.append(this.departmentCode).append('.');
143          _toStringValue.append(this.departmentCode2).append('.');
144          _toStringValue.append(this.lastName).append('.');
145          _toStringValue.append(']');
146       }
147
148       return _toStringValue.toString();
149    }
150
151 }
152
Popular Tags