KickJava   Java API By Example, From Geeks To Geeks.

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


1 //$Id: AddressId.java,v 1.2 2005/02/12 07:27:31 steveebersole Exp $
2
package org.hibernate.test.typedonetoone;
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 customerId;
12     
13     public AddressId(String JavaDoc type, String JavaDoc customerId) {
14         this.customerId = 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 getCustomerId() {
27         return customerId;
28     }
29     public void setCustomerId(String JavaDoc customerId) {
30         this.customerId = 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) && customerId.equals(add.customerId);
36     }
37     public int hashCode() {
38         return customerId.hashCode() + type.hashCode();
39     }
40
41 }
42
Popular Tags