KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > hibernate > test > filter > Category


1 // $Id: Category.java,v 1.1 2005/04/25 16:57:32 steveebersole Exp $
2
package org.hibernate.test.filter;
3
4 import java.util.Date JavaDoc;
5 import java.util.Set JavaDoc;
6
7 /**
8  * Implementation of Category.
9  *
10  * @author Steve Ebersole
11  */

12 public class Category {
13     private Long JavaDoc id;
14     private String JavaDoc name;
15     private Date JavaDoc effectiveStartDate;
16     private Date JavaDoc effectiveEndDate;
17     private Set JavaDoc products;
18
19     public Category() {
20     }
21
22     public Category(String JavaDoc name) {
23         this.name = name;
24     }
25
26     public Category(String JavaDoc name, Date JavaDoc effectiveStartDate, Date JavaDoc effectiveEndDate) {
27         this.name = name;
28         this.effectiveStartDate = effectiveStartDate;
29         this.effectiveEndDate = effectiveEndDate;
30     }
31
32     public Long JavaDoc getId() {
33         return id;
34     }
35
36     public void setId(Long JavaDoc id) {
37         this.id = id;
38     }
39
40     public String JavaDoc getName() {
41         return name;
42     }
43
44     public void setName(String JavaDoc name) {
45         this.name = name;
46     }
47
48     public Date JavaDoc getEffectiveStartDate() {
49         return effectiveStartDate;
50     }
51
52     public void setEffectiveStartDate(Date JavaDoc effectiveStartDate) {
53         this.effectiveStartDate = effectiveStartDate;
54     }
55
56     public Date JavaDoc getEffectiveEndDate() {
57         return effectiveEndDate;
58     }
59
60     public void setEffectiveEndDate(Date JavaDoc effectiveEndDate) {
61         this.effectiveEndDate = effectiveEndDate;
62     }
63
64     public Set JavaDoc getProducts() {
65         return products;
66     }
67
68     public void setProducts(Set JavaDoc products) {
69         this.products = products;
70     }
71
72     public boolean equals(Object JavaDoc o) {
73         if ( this == o ) return true;
74         if ( !( o instanceof Category ) ) return false;
75
76         final Category category = ( Category ) o;
77
78         if ( !name.equals( category.name ) ) {
79             return false;
80         }
81
82         if ( effectiveEndDate != null ?
83                 !effectiveEndDate.equals( category.effectiveEndDate ) :
84                 category.effectiveEndDate != null ) {
85             return false;
86         }
87
88         if ( effectiveStartDate != null ?
89                 !effectiveStartDate.equals( category.effectiveStartDate ) :
90                 category.effectiveStartDate != null ) {
91             return false;
92         }
93
94         return true;
95     }
96
97     public int hashCode() {
98         int result;
99         result = name.hashCode();
100         result = 29 * result + ( effectiveStartDate != null ? effectiveStartDate.hashCode() : 0 );
101         result = 29 * result + ( effectiveEndDate != null ? effectiveEndDate.hashCode() : 0 );
102         return result;
103     }
104 }
105
Popular Tags