View Javadoc
1   /*
2    * This class was automatically generated with 
3    * <a href="http://www.castor.org">Castor 1.3.1</a>, using an XML
4    * Schema.
5    * $Id$
6    */
7   
8   package org.exolab.castor.tests.framework.testDescriptor.types;
9   
10  /**
11   * Class CollectionType.
12   * 
13   * @version $Revision$ $Date$
14   */
15  public class CollectionType implements java.io.Serializable {
16  
17  
18        //--------------------------/
19       //- Class/Member Variables -/
20      //--------------------------/
21  
22      /**
23       * The vector type
24       */
25      public static final int VECTOR_TYPE = 0;
26  
27      /**
28       * The instance of the vector type
29       */
30      public static final CollectionType VECTOR = new CollectionType(VECTOR_TYPE, "vector");
31  
32      /**
33       * The arraylist type
34       */
35      public static final int ARRAYLIST_TYPE = 1;
36  
37      /**
38       * The instance of the arraylist type
39       */
40      public static final CollectionType ARRAYLIST = new CollectionType(ARRAYLIST_TYPE, "arraylist");
41  
42      /**
43       * The odmg type
44       */
45      public static final int ODMG_TYPE = 2;
46  
47      /**
48       * The instance of the odmg type
49       */
50      public static final CollectionType ODMG = new CollectionType(ODMG_TYPE, "odmg");
51  
52      /**
53       * Field _memberTable.
54       */
55      private static java.util.Hashtable _memberTable = init();
56  
57      /**
58       * Field type.
59       */
60      private final int type;
61  
62      /**
63       * Field stringValue.
64       */
65      private java.lang.String stringValue = null;
66  
67  
68        //----------------/
69       //- Constructors -/
70      //----------------/
71  
72      private CollectionType(final int type, final java.lang.String value) {
73          super();
74          this.type = type;
75          this.stringValue = value;
76      }
77  
78  
79        //-----------/
80       //- Methods -/
81      //-----------/
82  
83      /**
84       * Method enumerate.Returns an enumeration of all possible
85       * instances of CollectionType
86       * 
87       * @return an Enumeration over all possible instances of
88       * CollectionType
89       */
90      public static java.util.Enumeration enumerate(
91      ) {
92          return _memberTable.elements();
93      }
94  
95      /**
96       * Method getType.Returns the type of this CollectionType
97       * 
98       * @return the type of this CollectionType
99       */
100     public int getType(
101     ) {
102         return this.type;
103     }
104 
105     /**
106      * Method init.
107      * 
108      * @return the initialized Hashtable for the member table
109      */
110     private static java.util.Hashtable init(
111     ) {
112         java.util.Hashtable members = new java.util.Hashtable();
113         members.put("vector", VECTOR);
114         members.put("arraylist", ARRAYLIST);
115         members.put("odmg", ODMG);
116         return members;
117     }
118 
119     /**
120      * Method readResolve. will be called during deserialization to
121      * replace the deserialized object with the correct constant
122      * instance.
123      * 
124      * @return this deserialized object
125      */
126     private java.lang.Object readResolve(
127     ) {
128         return valueOf(this.stringValue);
129     }
130 
131     /**
132      * Method toString.Returns the String representation of this
133      * CollectionType
134      * 
135      * @return the String representation of this CollectionType
136      */
137     public java.lang.String toString(
138     ) {
139         return this.stringValue;
140     }
141 
142     /**
143      * Method valueOf.Returns a new CollectionType based on the
144      * given String value.
145      * 
146      * @param string
147      * @return the CollectionType value of parameter 'string'
148      */
149     public static org.exolab.castor.tests.framework.testDescriptor.types.CollectionType valueOf(
150             final java.lang.String string) {
151         java.lang.Object obj = null;
152         if (string != null) {
153             obj = _memberTable.get(string);
154         }
155         if (obj == null) {
156             String err = "" + string + " is not a valid CollectionType";
157             throw new IllegalArgumentException(err);
158         }
159         return (CollectionType) obj;
160     }
161 
162 }