KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > hibernate > test > typedmanytoone > AddressId


1 //$Id: AddressId.java,v 1.1 2005/06/01 03:51:32 oneovthafew Exp $
2
package org.hibernate.test.typedmanytoone;
3
4 import java.io.Serializable JavaDoc;
5
6 /**
7  * @author Gavin King
8  */

9 public class AddressId implements Serializable JavaDoc {
10     private String JavaDoc type;
11     private String JavaDoc addressId;
12     
13     public AddressId(String JavaDoc type, String JavaDoc customerId) {
14         this.addressId = customerId;
15         this.type = type;
16     }
17     
18     public AddressId() {}
19     
20     public String JavaDoc getType() {
21         return type;
22     }
23     public void setType(String JavaDoc type) {
24         this.type = type;
25     }
26     public String JavaDoc getAddressId() {
27         return addressId;
28     }
29     public void setAddressId(String JavaDoc customerId) {
30         this.addressId = customerId;
31     }
32     public boolean equals(Object JavaDoc other) {
33         if ( !(other instanceof AddressId) ) return false;
34         AddressId add = (AddressId) other;
35         return type.equals(add.type) && addressId.equals(add.addressId);
36     }
37     public int hashCode() {
38         return addressId.hashCode() + type.hashCode();
39     }
40     
41     public String JavaDoc toString() {
42         return type + '#' + addressId;
43     }
44
45 }
46
Popular Tags