KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jboss > test > cmp2 > cmrtree > ejb > BPK


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

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

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