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