001: /*
002: * This class was automatically generated with
003: * <a href="http://www.castor.org">Castor 1.1-M2</a>, using an XML
004: * Schema.
005: * $Id: FieldTypeCollectionType.java 6766 2007-01-18 21:12:08Z wguttmn $
006: */
007:
008: package org.exolab.castor.builder.binding.xml.types;
009:
010: //---------------------------------/
011: //- Imported classes and packages -/
012: //---------------------------------/
013:
014: import java.util.Hashtable;
015:
016: /**
017: * Class FieldTypeCollectionType.
018: *
019: * @version $Revision: 6766 $ $Date$
020: */
021: public class FieldTypeCollectionType implements java.io.Serializable {
022:
023: //--------------------------/
024: //- Class/Member Variables -/
025: //--------------------------/
026:
027: /**
028: * The array type
029: */
030: public static final int ARRAY_TYPE = 0;
031:
032: /**
033: * The instance of the array type
034: */
035: public static final FieldTypeCollectionType ARRAY = new FieldTypeCollectionType(
036: ARRAY_TYPE, "array");
037:
038: /**
039: * The vector type
040: */
041: public static final int VECTOR_TYPE = 1;
042:
043: /**
044: * The instance of the vector type
045: */
046: public static final FieldTypeCollectionType VECTOR = new FieldTypeCollectionType(
047: VECTOR_TYPE, "vector");
048:
049: /**
050: * The arraylist type
051: */
052: public static final int ARRAYLIST_TYPE = 2;
053:
054: /**
055: * The instance of the arraylist type
056: */
057: public static final FieldTypeCollectionType ARRAYLIST = new FieldTypeCollectionType(
058: ARRAYLIST_TYPE, "arraylist");
059:
060: /**
061: * The hashtable type
062: */
063: public static final int HASHTABLE_TYPE = 3;
064:
065: /**
066: * The instance of the hashtable type
067: */
068: public static final FieldTypeCollectionType HASHTABLE = new FieldTypeCollectionType(
069: HASHTABLE_TYPE, "hashtable");
070:
071: /**
072: * The collection type
073: */
074: public static final int COLLECTION_TYPE = 4;
075:
076: /**
077: * The instance of the collection type
078: */
079: public static final FieldTypeCollectionType COLLECTION = new FieldTypeCollectionType(
080: COLLECTION_TYPE, "collection");
081:
082: /**
083: * The odmg type
084: */
085: public static final int ODMG_TYPE = 5;
086:
087: /**
088: * The instance of the odmg type
089: */
090: public static final FieldTypeCollectionType ODMG = new FieldTypeCollectionType(
091: ODMG_TYPE, "odmg");
092:
093: /**
094: * The set type
095: */
096: public static final int SET_TYPE = 6;
097:
098: /**
099: * The instance of the set type
100: */
101: public static final FieldTypeCollectionType SET = new FieldTypeCollectionType(
102: SET_TYPE, "set");
103:
104: /**
105: * The map type
106: */
107: public static final int MAP_TYPE = 7;
108:
109: /**
110: * The instance of the map type
111: */
112: public static final FieldTypeCollectionType MAP = new FieldTypeCollectionType(
113: MAP_TYPE, "map");
114:
115: /**
116: * The sortedset type
117: */
118: public static final int SORTEDSET_TYPE = 8;
119:
120: /**
121: * The instance of the sortedset type
122: */
123: public static final FieldTypeCollectionType SORTEDSET = new FieldTypeCollectionType(
124: SORTEDSET_TYPE, "sortedset");
125:
126: /**
127: * Field _memberTable.
128: */
129: private static java.util.Hashtable _memberTable = init();
130:
131: /**
132: * Field type.
133: */
134: private int type = -1;
135:
136: /**
137: * Field stringValue.
138: */
139: private java.lang.String stringValue = null;
140:
141: //----------------/
142: //- Constructors -/
143: //----------------/
144:
145: private FieldTypeCollectionType(final int type,
146: final java.lang.String value) {
147: super ();
148: this .type = type;
149: this .stringValue = value;
150: }
151:
152: //-----------/
153: //- Methods -/
154: //-----------/
155:
156: /**
157: * Method enumerate.Returns an enumeration of all possible
158: * instances of FieldTypeCollectionType
159: *
160: * @return an Enumeration over all possible instances of
161: * FieldTypeCollectionType
162: */
163: public static java.util.Enumeration enumerate() {
164: return _memberTable.elements();
165: }
166:
167: /**
168: * Method getType.Returns the type of this
169: * FieldTypeCollectionType
170: *
171: * @return the type of this FieldTypeCollectionType
172: */
173: public int getType() {
174: return this .type;
175: }
176:
177: /**
178: * Method init.
179: *
180: * @return the initialized Hashtable for the member table
181: */
182: private static java.util.Hashtable init() {
183: Hashtable members = new Hashtable();
184: members.put("array", ARRAY);
185: members.put("vector", VECTOR);
186: members.put("arraylist", ARRAYLIST);
187: members.put("hashtable", HASHTABLE);
188: members.put("collection", COLLECTION);
189: members.put("odmg", ODMG);
190: members.put("set", SET);
191: members.put("map", MAP);
192: members.put("sortedset", SORTEDSET);
193: return members;
194: }
195:
196: /**
197: * Method readResolve. will be called during deserialization to
198: * replace the deserialized object with the correct constant
199: * instance.
200: *
201: * @return this deserialized object
202: */
203: private java.lang.Object readResolve() {
204: return valueOf(this .stringValue);
205: }
206:
207: /**
208: * Method toString.Returns the String representation of this
209: * FieldTypeCollectionType
210: *
211: * @return the String representation of this
212: * FieldTypeCollectionType
213: */
214: public java.lang.String toString() {
215: return this .stringValue;
216: }
217:
218: /**
219: * Method valueOf.Returns a new FieldTypeCollectionType based
220: * on the given String value.
221: *
222: * @param string
223: * @return the FieldTypeCollectionType value of parameter
224: * 'string'
225: */
226: public static org.exolab.castor.builder.binding.xml.types.FieldTypeCollectionType valueOf(
227: final java.lang.String string) {
228: java.lang.Object obj = null;
229: if (string != null) {
230: obj = _memberTable.get(string);
231: }
232: if (obj == null) {
233: String err = "" + string
234: + " is not a valid FieldTypeCollectionType";
235: throw new IllegalArgumentException(err);
236: }
237: return (FieldTypeCollectionType) obj;
238: }
239:
240: }
|