1 package org.hibernate.test.filter; 3 4 import java.util.Date ; 5 import java.util.Set ; 6 7 12 public class Category { 13 private Long id; 14 private String name; 15 private Date effectiveStartDate; 16 private Date effectiveEndDate; 17 private Set products; 18 19 public Category() { 20 } 21 22 public Category(String name) { 23 this.name = name; 24 } 25 26 public Category(String name, Date effectiveStartDate, Date effectiveEndDate) { 27 this.name = name; 28 this.effectiveStartDate = effectiveStartDate; 29 this.effectiveEndDate = effectiveEndDate; 30 } 31 32 public Long getId() { 33 return id; 34 } 35 36 public void setId(Long id) { 37 this.id = id; 38 } 39 40 public String getName() { 41 return name; 42 } 43 44 public void setName(String name) { 45 this.name = name; 46 } 47 48 public Date getEffectiveStartDate() { 49 return effectiveStartDate; 50 } 51 52 public void setEffectiveStartDate(Date effectiveStartDate) { 53 this.effectiveStartDate = effectiveStartDate; 54 } 55 56 public Date getEffectiveEndDate() { 57 return effectiveEndDate; 58 } 59 60 public void setEffectiveEndDate(Date effectiveEndDate) { 61 this.effectiveEndDate = effectiveEndDate; 62 } 63 64 public Set getProducts() { 65 return products; 66 } 67 68 public void setProducts(Set products) { 69 this.products = products; 70 } 71 72 public boolean equals(Object 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 |