1 4 package org.jboss.test.cmp2.fkstackoverflow.ejb; 5 6 9 public class ComplexParentPK 10 extends java.lang.Object 11 implements java.io.Serializable 12 { 13 private int _hashCode = 0; 14 private StringBuffer _toStringValue = null; 15 16 public java.lang.Long id1; 17 public java.lang.Long id2; 18 19 public ComplexParentPK() 20 { 21 } 22 23 public ComplexParentPK( java.lang.Long id1,java.lang.Long id2 ) 24 { 25 this.id1 = id1; 26 this.id2 = id2; 27 } 28 29 public java.lang.Long getId1() 30 { 31 return id1; 32 } 33 public java.lang.Long getId2() 34 { 35 return id2; 36 } 37 38 public void setId1(java.lang.Long id1) 39 { 40 this.id1 = id1; 41 _hashCode = 0; 42 } 43 public void setId2(java.lang.Long 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 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 110 public String toString() 111 { 112 if( _toStringValue == null ) 113 { 114 _toStringValue = new StringBuffer ("[."); 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 |