KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jboss > test > cmp2 > fkstackoverflow > ejb > ComplexParentPK


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

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

9 public class ComplexParentPK
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.Long JavaDoc id1;
17    public java.lang.Long JavaDoc id2;
18
19    public ComplexParentPK()
20    {
21    }
22
23    public ComplexParentPK( java.lang.Long JavaDoc id1,java.lang.Long JavaDoc id2 )
24    {
25       this.id1 = id1;
26       this.id2 = id2;
27    }
28
29    public java.lang.Long JavaDoc getId1()
30    {
31       return id1;
32    }
33    public java.lang.Long JavaDoc getId2()
34    {
35       return id2;
36    }
37
38    public void setId1(java.lang.Long JavaDoc id1)
39    {
40       this.id1 = id1;
41       _hashCode = 0;
42    }
43    public void setId2(java.lang.Long JavaDoc id2)
44    {
45       this.id2 = id2;
46       _hashCode = 0;
47    }
48
49    public int hashCode()
50    {
51       if( _hashCode == 0 )
52       {
53          if (this.id1 != null) _hashCode += this.id1.hashCode();
54          if (this.id2 != null) _hashCode += this.id2.hashCode();
55       }
56
57       return _hashCode;
58    }
59
60    public boolean equals(Object JavaDoc obj)
61    {
62       if( !(obj instanceof org.jboss.test.cmp2.fkstackoverflow.ejb.ComplexParentPK) )
63          return false;
64
65       org.jboss.test.cmp2.fkstackoverflow.ejb.ComplexParentPK pk = (org.jboss.test.cmp2.fkstackoverflow.ejb.ComplexParentPK)obj;
66       boolean eq = true;
67
68       if( obj == null )
69       {
70          eq = false;
71       }
72       else
73       {
74          if( this.id1 == null && ((org.jboss.test.cmp2.fkstackoverflow.ejb.ComplexParentPK)obj).getId1() == null )
75          {
76             eq = true;
77          }
78          else
79          {
80             if( this.id1 == null || ((org.jboss.test.cmp2.fkstackoverflow.ejb.ComplexParentPK)obj).getId1() == null )
81             {
82                eq = false;
83             }
84             else
85             {
86                eq = eq && this.id1.equals( pk.id1 );
87             }
88          }
89          if( this.id2 == null && ((org.jboss.test.cmp2.fkstackoverflow.ejb.ComplexParentPK)obj).getId2() == null )
90          {
91             eq = true;
92          }
93          else
94          {
95             if( this.id2 == null || ((org.jboss.test.cmp2.fkstackoverflow.ejb.ComplexParentPK)obj).getId2() == null )
96             {
97                eq = false;
98             }
99             else
100             {
101                eq = eq && this.id2.equals( pk.id2 );
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.id1).append('.');
116          _toStringValue.append(this.id2).append('.');
117          _toStringValue.append(']');
118       }
119
120       return _toStringValue.toString();
121    }
122
123 }
124
Popular Tags