1 22 package org.jboss.test.bench.interfaces; 23 24 import java.io.Serializable ; 25 import java.io.IOException ; 26 27 public class AComplexPK implements Serializable { 28 29 public boolean aBoolean; 30 public int anInt; 31 public long aLong; 32 public double aDouble; 33 public String aString; 34 35 public AComplexPK() {}; 36 37 38 public AComplexPK(boolean aBoolean, int anInt, long aLong, double aDouble, String aString) { 39 40 this.aBoolean = aBoolean; 41 this.anInt = anInt; 42 this.aLong = aLong; 43 this.aDouble = aDouble; 44 this.aString = aString; 45 } 46 47 public boolean equals(Object other) { 48 if (other != null && other instanceof AComplexPK) { 49 AComplexPK otherPK = (AComplexPK)other; 50 return ((aBoolean == otherPK.aBoolean) && 51 (anInt == otherPK.anInt) && 52 (aLong == otherPK.aLong) && 53 (aDouble == otherPK.aDouble) && 54 (aString == null ? otherPK.aString == null : aString.equals(otherPK.aString))); 55 } else return false; 56 } 57 58 59 public int hashCode() { 60 61 63 return anInt* 64 (new Long (aLong)).intValue()* 65 (new Double (aDouble)).intValue()* 66 aString.hashCode(); 67 } 68 } 69 70 | Popular Tags |