KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > infoglue > cms > entities > management > CategoryAttribute


1 package org.infoglue.cms.entities.management;
2
3 import org.infoglue.cms.util.DomainUtils;
4
5 /**
6  * This is used to represent the XMLSchema values assocaited with a CategoryAttribute
7  *
8  * @author Frank Febbraro (frank@phase2technology.com)
9  */

10 public class CategoryAttribute implements Comparable JavaDoc
11 {
12     private String JavaDoc value;
13     private String JavaDoc title;
14     private String JavaDoc description;
15     private Integer JavaDoc categoryId;
16     private String JavaDoc categoryName;
17
18     public CategoryAttribute(String JavaDoc value)
19     {
20         this(value, null);
21     }
22
23     public CategoryAttribute(String JavaDoc value, String JavaDoc categoryId)
24     {
25         this.value = value;
26         this.categoryId = (categoryId != null) ? new Integer JavaDoc(categoryId) : null;
27     }
28
29     public CategoryAttribute(String JavaDoc value, String JavaDoc categoryId, String JavaDoc title, String JavaDoc desc)
30     {
31         this.value = value;
32         this.categoryId = (categoryId != null) ? new Integer JavaDoc(categoryId) : null;
33         this.title = title;
34         this.description = desc;
35     }
36
37     public String JavaDoc getValue() { return value; }
38     public void setValue(String JavaDoc s) { value = s; }
39
40     public String JavaDoc getTitle() { return title; }
41     public void setTitle(String JavaDoc s) { title = s; }
42
43     public String JavaDoc getDescription() { return description; }
44     public void setDescription(String JavaDoc s) { description = s; }
45
46     public Integer JavaDoc getCategoryId() { return categoryId; }
47     public void setCategoryId(String JavaDoc s) { categoryId = (s != null) ? new Integer JavaDoc(s) : null; }
48
49     public String JavaDoc getCategoryName() { return categoryName; }
50     public void setCategoryName(String JavaDoc s) { categoryName = s; }
51
52     /**
53      * Compares this object to another for order
54      * @param o an object
55      * @return a value less then 0, 0, or greater than 0 as this object is less than, equal to, or greater than o
56      * @throws ClassCastException if o is not an instance of CategoryAttribute
57      */

58     public int compareTo(Object JavaDoc o)
59     {
60         if (!(o instanceof CategoryAttribute))
61             throw new ClassCastException JavaDoc();
62
63         return new Integer JavaDoc(hashCode()).compareTo(new Integer JavaDoc(o.hashCode()));
64     }
65
66     /**
67      * Defines the hash code for this object, which is based on category ID.
68      * @return the hash code associated with the category ID
69      */

70     public int hashCode()
71     {
72         return (categoryId == null) ? new Integer JavaDoc(0).hashCode() : categoryId.hashCode();
73     }
74
75     public boolean equals(Object JavaDoc o)
76     {
77         CategoryAttribute other = (CategoryAttribute)o;
78         return DomainUtils.equals(value, other.value)
79                 && DomainUtils.equals(title, other.title)
80                 && DomainUtils.equals(description, other.description)
81                 && DomainUtils.equals(categoryId, other.categoryId);
82     }
83
84     public String JavaDoc toString()
85     {
86         StringBuffer JavaDoc sb = new StringBuffer JavaDoc();
87         sb.append("value=").append(value)
88             .append(" title=").append(title)
89             .append(" description=").append(description)
90             .append(" categoryId=").append(categoryId);
91         return sb.toString();
92     }
93 }
94
95
Popular Tags