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