1 22 package org.jboss.test.cmp2.jbas1361; 23 24 public class BPK 25 extends Object 26 implements java.io.Serializable 27 { 28 private int _hashCode = 0; 29 private StringBuffer _toStringValue = null; 30 31 public Integer id; 32 public String name; 33 34 public BPK() 35 { 36 } 37 38 public BPK( Integer id,String name ) 39 { 40 this.id = id; 41 this.name = name; 42 } 43 44 public Integer getId() 45 { 46 return id; 47 } 48 public String getName() 49 { 50 return name; 51 } 52 53 public void setId(Integer id) 54 { 55 this.id = id; 56 _hashCode = 0; 57 } 58 public void setName(String name) 59 { 60 this.name = name; 61 _hashCode = 0; 62 } 63 64 public int hashCode() 65 { 66 if( _hashCode == 0 ) 67 { 68 if (this.id != null) _hashCode += this.id.hashCode(); 69 if (this.name != null) _hashCode += this.name.hashCode(); 70 } 71 72 return _hashCode; 73 } 74 75 public boolean equals(Object obj) 76 { 77 if( !(obj instanceof org.jboss.test.cmp2.jbas1361.BPK) ) 78 return false; 79 80 org.jboss.test.cmp2.jbas1361.BPK pk = (org.jboss.test.cmp2.jbas1361.BPK)obj; 81 boolean eq = true; 82 83 if( obj == null ) 84 { 85 eq = false; 86 } 87 else 88 { 89 if( this.id == null && ((org.jboss.test.cmp2.jbas1361.BPK)obj).getId() == null ) 90 { 91 eq = true; 92 } 93 else 94 { 95 if( this.id == null || ((org.jboss.test.cmp2.jbas1361.BPK)obj).getId() == null ) 96 { 97 eq = false; 98 } 99 else 100 { 101 eq = eq && this.id.equals( pk.id ); 102 } 103 } 104 if( this.name == null && ((org.jboss.test.cmp2.jbas1361.BPK)obj).getName() == null ) 105 { 106 eq = true; 107 } 108 else 109 { 110 if( this.name == null || ((org.jboss.test.cmp2.jbas1361.BPK)obj).getName() == null ) 111 { 112 eq = false; 113 } 114 else 115 { 116 eq = eq && this.name.equals( pk.name ); 117 } 118 } 119 } 120 121 return eq; 122 } 123 124 125 public String toString() 126 { 127 if( _toStringValue == null ) 128 { 129 _toStringValue = new StringBuffer ("[."); 130 _toStringValue.append(this.id).append('.'); 131 _toStringValue.append(this.name).append('.'); 132 _toStringValue.append(']'); 133 } 134 135 return _toStringValue.toString(); 136 } 137 } 138 | Popular Tags |