01: /*
02: * Copyright (C) 1999-2004 <A href="http://www-ist.massey.ac.nz/JBDietrich" target="_top">Jens Dietrich</a>
03: *
04: * This library is free software; you can redistribute it and/or
05: * modify it under the terms of the GNU Lesser General Public
06: * License as published by the Free Software Foundation; either
07: * version 2 of the License, or (at your option) any later version.
08: *
09: * This library is distributed in the hope that it will be useful,
10: * but WITHOUT ANY WARRANTY; without even the implied warranty of
11: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12: * Lesser General Public License for more details.
13: *
14: * You should have received a copy of the GNU Lesser General Public
15: * License along with this library; if not, write to the Free Software
16: * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17: */
18: package org.mandarax.examples.crm.domainmodel;
19:
20: /**
21: * Represents a categories of customers. Something like "Gold customer program".
22: * @author <A href="http://www-ist.massey.ac.nz/JBDietrich" target="_top">Jens Dietrich</A>
23: * @version 3.4 <7 March 05>
24: * @since 1.2
25: */
26: public class Category extends BusinessObject {
27:
28: public final static Category PLATINUM = new Category("Platinum");
29: public final static Category GOLD = new Category("Gold");
30: public final static Category STANDARD = new Category("Standard");
31: private String description = "?";
32:
33: /**
34: * Constructor.
35: * @param aDescription java.lang.String
36: */
37: public Category() {
38: super ();
39: }
40:
41: /**
42: * Constructor.
43: * @param aDescription java.lang.String
44: */
45: public Category(String aDescription) {
46: super ();
47:
48: description = aDescription;
49: }
50:
51: /**
52: * Compares objects.
53: * @return boolean
54: * @param obj java.lang.Object
55: */
56: public boolean equals(Object obj) {
57: return (obj instanceof Category)
58: && description.equals(((Category) obj).description);
59: }
60:
61: /**
62: * Get the description.
63: * @return java.lang.String
64: */
65: public String getDescription() {
66: return description;
67: }
68:
69: /**
70: * Get the hash code.
71: * @return int
72: */
73: public int hashCode() {
74: return (description == null) ? 0 : description.hashCode();
75: }
76:
77: /**
78: * Convert the object to a string.
79: * @return java.lang.String
80: */
81: public String toString() {
82: return getDescription();
83: }
84: }
|