KickJava   Java API By Example, From Geeks To Geeks.

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


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

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

9 public class DepartmentPK
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
19    public DepartmentPK()
20    {
21    }
22
23    public DepartmentPK( java.lang.String JavaDoc departmentCode,java.lang.String JavaDoc departmentCode2 )
24    {
25       this.departmentCode = departmentCode;
26       this.departmentCode2 = departmentCode2;
27    }
28
29    public java.lang.String JavaDoc getDepartmentCode()
30    {
31       return departmentCode;
32    }
33    public java.lang.String JavaDoc getDepartmentCode2()
34    {
35       return departmentCode2;
36    }
37
38    public void setDepartmentCode(java.lang.String JavaDoc departmentCode)
39    {
40       this.departmentCode = departmentCode;
41       _hashCode = 0;
42    }
43    public void setDepartmentCode2(java.lang.String JavaDoc departmentCode2)
44    {
45       this.departmentCode2 = departmentCode2;
46       _hashCode = 0;
47    }
48
49    public int hashCode()
50    {
51       if( _hashCode == 0 )
52       {
53          if (this.departmentCode != null) _hashCode += this.departmentCode.hashCode();
54          if (this.departmentCode2 != null) _hashCode += this.departmentCode2.hashCode();
55       }
56
57       return _hashCode;
58    }
59
60    public boolean equals(Object JavaDoc obj)
61    {
62       if( !(obj instanceof org.jboss.test.cmp2.fkmapping.ejb.DepartmentPK) )
63          return false;
64
65       org.jboss.test.cmp2.fkmapping.ejb.DepartmentPK pk = (org.jboss.test.cmp2.fkmapping.ejb.DepartmentPK)obj;
66       boolean eq = true;
67
68       if( obj == null )
69       {
70          eq = false;
71       }
72       else
73       {
74          if( this.departmentCode == null && ((org.jboss.test.cmp2.fkmapping.ejb.DepartmentPK)obj).getDepartmentCode() == null )
75          {
76             eq = true;
77          }
78          else
79          {
80             if( this.departmentCode == null || ((org.jboss.test.cmp2.fkmapping.ejb.DepartmentPK)obj).getDepartmentCode() == null )
81             {
82                eq = false;
83             }
84             else
85             {
86                eq = eq && this.departmentCode.equals( pk.departmentCode );
87             }
88          }
89          if( this.departmentCode2 == null && ((org.jboss.test.cmp2.fkmapping.ejb.DepartmentPK)obj).getDepartmentCode2() == null )
90          {
91             eq = true;
92          }
93          else
94          {
95             if( this.departmentCode2 == null || ((org.jboss.test.cmp2.fkmapping.ejb.DepartmentPK)obj).getDepartmentCode2() == null )
96             {
97                eq = false;
98             }
99             else
100             {
101                eq = eq && this.departmentCode2.equals( pk.departmentCode2 );
102             }
103          }
104       }
105
106       return eq;
107    }
108
109    /** @return String representation of this pk in the form of [.field1.field2.field3]. */
110    public String JavaDoc toString()
111    {
112       if( _toStringValue == null )
113       {
114          _toStringValue = new StringBuffer JavaDoc("[.");
115          _toStringValue.append(this.departmentCode).append('.');
116          _toStringValue.append(this.departmentCode2).append('.');
117          _toStringValue.append(']');
118       }
119
120       return _toStringValue.toString();
121    }
122
123 }
124
Popular Tags