Source code: com/thermidor/util/Enum.java
1 package com.thermidor.util;
2 import java.io.Serializable;
3 /**
4 * The Enum class is the abstract base class that should be used for all
5 * implementation of enumeration. It is intended that Enumerations should be
6 * generated from meta data
7 * @version 1.0
8 * @author Edward Turnock
9 */
10 public abstract class Enum implements Serializable {
11 /**
12 * The id attribute should be unique for the instance.
13 * @serial
14 */
15 protected Integer id;
16 /**
17 * The value string that will represent the label for this ENum instance
18 * when it is externalized.
19 */
20 private transient String value;
21 /**
22 * Construct a default instance of the Enum.
23 */
24 /**
25 * Construct a new Enum instance with the specified id and value.
26 * @param id the id of the enumeration member.
27 * @param value to value/label for the member.
28 */
29 public Enum(String value,
30 int id) {
31 this.id = new Integer(id);
32 this.value = value;
33 }
34
35 /**
36 * Return the id of the member instance.
37 * @return the unique identifier for this instance.
38 */
39 public final int getId() {
40 return id.intValue();
41 }
42
43 /**
44 * Return the value label of this enumeration memeber instance.
45 * @return the value of this enum member.
46 */
47 public final String toString() {
48 return value;
49 }
50 }
51
52
53
54
55
56
57
58
59