1
2
3
4
5
6
7
8 package org.astrogrid.registry.beans.resource.votable.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 * Class STREAMEncodingType.
22 *
23 * @version $Revision: 1.14 $ $Date: 2007/01/04 16:26:15 $
24 */
25 public class STREAMEncodingType implements java.io.Serializable {
26
27
28
29
30
31
32 /***
33 * The gzip type
34 */
35 public static final int GZIP_TYPE = 0;
36
37 /***
38 * The instance of the gzip type
39 */
40 public static final STREAMEncodingType GZIP = new STREAMEncodingType(GZIP_TYPE, "gzip");
41
42 /***
43 * The base64 type
44 */
45 public static final int BASE64_TYPE = 1;
46
47 /***
48 * The instance of the base64 type
49 */
50 public static final STREAMEncodingType BASE64 = new STREAMEncodingType(BASE64_TYPE, "base64");
51
52 /***
53 * The dynamic type
54 */
55 public static final int DYNAMIC_TYPE = 2;
56
57 /***
58 * The instance of the dynamic type
59 */
60 public static final STREAMEncodingType DYNAMIC = new STREAMEncodingType(DYNAMIC_TYPE, "dynamic");
61
62 /***
63 * The none type
64 */
65 public static final int NONE_TYPE = 3;
66
67 /***
68 * The instance of the none type
69 */
70 public static final STREAMEncodingType NONE = new STREAMEncodingType(NONE_TYPE, "none");
71
72 /***
73 * Field _memberTable
74 */
75 private static java.util.Hashtable _memberTable = init();
76
77 /***
78 * Field type
79 */
80 private int type = -1;
81
82 /***
83 * Field stringValue
84 */
85 private java.lang.String stringValue = null;
86
87
88
89
90
91
92 private STREAMEncodingType(int type, java.lang.String value) {
93 super();
94 this.type = type;
95 this.stringValue = value;
96 }
97
98
99
100
101
102
103 /***
104 * Method enumerateReturns an enumeration of all possible
105 * instances of STREAMEncodingType
106 */
107 public static java.util.Enumeration enumerate()
108 {
109 return _memberTable.elements();
110 }
111
112 /***
113 * Method getTypeReturns the type of this STREAMEncodingType
114 */
115 public int getType()
116 {
117 return this.type;
118 }
119
120 /***
121 * Method init
122 */
123 private static java.util.Hashtable init()
124 {
125 Hashtable members = new Hashtable();
126 members.put("gzip", GZIP);
127 members.put("base64", BASE64);
128 members.put("dynamic", DYNAMIC);
129 members.put("none", NONE);
130 return members;
131 }
132
133 /***
134 * Method toStringReturns the String representation of this
135 * STREAMEncodingType
136 */
137 public java.lang.String toString()
138 {
139 return this.stringValue;
140 }
141
142 /***
143 * Method valueOfReturns a new STREAMEncodingType based on the
144 * given String value.
145 *
146 * @param string
147 */
148 public static org.astrogrid.registry.beans.resource.votable.types.STREAMEncodingType valueOf(java.lang.String string)
149 {
150 java.lang.Object obj = null;
151 if (string != null) obj = _memberTable.get(string);
152 if (obj == null) {
153 String err = "'" + string + "' is not a valid STREAMEncodingType";
154 throw new IllegalArgumentException(err);
155 }
156 return (STREAMEncodingType) obj;
157 }
158
159 }