01: /*
02: Mdarad-Toolobox is a collection of tools for Architected RAD
03: (Rapid Application Development) based on an MDA approach.
04: The toolbox contains frameworks and generators for many environments
05: (JAVA, J2EE, Hibernate, .NET, C++, etc.) which allow to generate
06: applications from a design Model
07: Copyright (C) 2004-2005 Elapse Technologies Inc.
08:
09: This library is free software; you can redistribute it and/or
10: modify it under the terms of the GNU General Public
11: License as published by the Free Software Foundation; either
12: version 2.1 of the License, or (at your option) any later version.
13:
14: This library is distributed in the hope that it will be useful,
15: but WITHOUT ANY WARRANTY; without even the implied warranty of
16: MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17: General Public License for more details.
18:
19: You should have received a copy of the GNU General Public
20: License along with this library; if not, write to the Free Software
21: Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22: */
23: package org.mdarad.framework.enumeration;
24:
25: import java.io.Serializable;
26:
27: /**
28: * This class represents a enumeration value needed to create an enumeration
29: * class (not yet supported by the MDARAD GENERATOR)
30: *
31: * @author Philippe Brouillette
32: * @version 1.0
33: */
34: public abstract class AllowableValue implements Serializable {
35:
36: /**
37: * Public constructor that initializes the value and the
38: * label of the allowable value
39: * @param value String that represents the value
40: * @param label Label associated to the allowable value
41: */
42: public AllowableValue(String value, String label) {
43: this .value = value;
44: this .label = label;
45: }
46:
47: /** Properties */
48:
49: /**
50: * String that represents the value
51: */
52: private String value;
53:
54: public String getValue() {
55: return value;
56: }
57:
58: public void setValue(String string) {
59: value = string;
60: }
61:
62: /**
63: * Property that contains the label associated to the allowable value
64: */
65: private String label;
66:
67: public String getLabel() {
68: return label;
69: }
70:
71: public void setLabel(String string) {
72: label = string;
73: }
74:
75: /**
76: * Indicates whether some AllowableValue object is equals to this one
77: * @param obj Object that must be an instance of AllowableValue
78: * @return true if this object is the same as the obj argument; false otherwise.
79: * @exception IllegalArgumentException Thown if the object is not of type AllowableValue
80: * @see java.lang.Object#equals(java.lang.Object)
81: */
82: public boolean equals(Object obj) {
83: if (!(obj instanceof AllowableValue)) {
84: throw new IllegalArgumentException(
85: "The object to be compared is of the wrong type");
86: }
87:
88: AllowableValue allObj = (AllowableValue) obj;
89: return this.getValue().equals(allObj.getValue());
90: }
91: }
|