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