1
2
3
4
5
6
7
8 package org.astrogrid.applications.beans.v1.types;
9
10
11
12
13
14 import java.io.Serializable;
15 import java.util.Enumeration;
16 import java.util.Hashtable;
17 import org.exolab.castor.xml.Marshaller;
18 import org.exolab.castor.xml.Unmarshaller;
19
20 /***
21 * normal is the -x value style and keyword is the x=value style
22 *
23 * @version $Revision: 1.36 $ $Date: 2007/01/04 16:26:23 $
24 */
25 public class SwitchTypes implements java.io.Serializable {
26
27
28
29
30
31
32 /***
33 * The normal type
34 */
35 public static final int NORMAL_TYPE = 0;
36
37 /***
38 * The instance of the normal type
39 */
40 public static final SwitchTypes NORMAL = new SwitchTypes(NORMAL_TYPE, "normal");
41
42 /***
43 * The keyword type
44 */
45 public static final int KEYWORD_TYPE = 1;
46
47 /***
48 * The instance of the keyword type
49 */
50 public static final SwitchTypes KEYWORD = new SwitchTypes(KEYWORD_TYPE, "keyword");
51
52 /***
53 * Field _memberTable
54 */
55 private static java.util.Hashtable _memberTable = init();
56
57 /***
58 * Field type
59 */
60 private int type = -1;
61
62 /***
63 * Field stringValue
64 */
65 private java.lang.String stringValue = null;
66
67
68
69
70
71
72 private SwitchTypes(int type, java.lang.String value) {
73 super();
74 this.type = type;
75 this.stringValue = value;
76 }
77
78
79
80
81
82
83 /***
84 * Method enumerateReturns an enumeration of all possible
85 * instances of SwitchTypes
86 */
87 public static java.util.Enumeration enumerate()
88 {
89 return _memberTable.elements();
90 }
91
92 /***
93 * Method getTypeReturns the type of this SwitchTypes
94 */
95 public int getType()
96 {
97 return this.type;
98 }
99
100 /***
101 * Method init
102 */
103 private static java.util.Hashtable init()
104 {
105 Hashtable members = new Hashtable();
106 members.put("normal", NORMAL);
107 members.put("keyword", KEYWORD);
108 return members;
109 }
110
111 /***
112 * Method toStringReturns the String representation of this
113 * SwitchTypes
114 */
115 public java.lang.String toString()
116 {
117 return this.stringValue;
118 }
119
120 /***
121 * Method valueOfReturns a new SwitchTypes based on the given
122 * String value.
123 *
124 * @param string
125 */
126 public static org.astrogrid.applications.beans.v1.types.SwitchTypes valueOf(java.lang.String string)
127 {
128 java.lang.Object obj = null;
129 if (string != null) obj = _memberTable.get(string);
130 if (obj == null) {
131 String err = "'" + string + "' is not a valid SwitchTypes";
132 throw new IllegalArgumentException(err);
133 }
134 return (SwitchTypes) obj;
135 }
136
137 }