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$
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 FieldTypeVisibilityType.
018: *
019: * @version $Revision$ $Date$
020: */
021: public class FieldTypeVisibilityType implements java.io.Serializable {
022:
023: //--------------------------/
024: //- Class/Member Variables -/
025: //--------------------------/
026:
027: /**
028: * The public type
029: */
030: public static final int PUBLIC_TYPE = 0;
031:
032: /**
033: * The instance of the public type
034: */
035: public static final FieldTypeVisibilityType PUBLIC = new FieldTypeVisibilityType(
036: PUBLIC_TYPE, "public");
037:
038: /**
039: * The protected type
040: */
041: public static final int PROTECTED_TYPE = 1;
042:
043: /**
044: * The instance of the protected type
045: */
046: public static final FieldTypeVisibilityType PROTECTED = new FieldTypeVisibilityType(
047: PROTECTED_TYPE, "protected");
048:
049: /**
050: * The private type
051: */
052: public static final int PRIVATE_TYPE = 2;
053:
054: /**
055: * The instance of the private type
056: */
057: public static final FieldTypeVisibilityType PRIVATE = new FieldTypeVisibilityType(
058: PRIVATE_TYPE, "private");
059:
060: /**
061: * Field _memberTable.
062: */
063: private static java.util.Hashtable _memberTable = init();
064:
065: /**
066: * Field type.
067: */
068: private int type = -1;
069:
070: /**
071: * Field stringValue.
072: */
073: private java.lang.String stringValue = null;
074:
075: //----------------/
076: //- Constructors -/
077: //----------------/
078:
079: private FieldTypeVisibilityType(final int type,
080: final java.lang.String value) {
081: super ();
082: this .type = type;
083: this .stringValue = value;
084: }
085:
086: //-----------/
087: //- Methods -/
088: //-----------/
089:
090: /**
091: * Method enumerate.Returns an enumeration of all possible
092: * instances of FieldTypeVisibilityType
093: *
094: * @return an Enumeration over all possible instances of
095: * FieldTypeVisibilityType
096: */
097: public static java.util.Enumeration enumerate() {
098: return _memberTable.elements();
099: }
100:
101: /**
102: * Method getType.Returns the type of this
103: * FieldTypeVisibilityType
104: *
105: * @return the type of this FieldTypeVisibilityType
106: */
107: public int getType() {
108: return this .type;
109: }
110:
111: /**
112: * Method init.
113: *
114: * @return the initialized Hashtable for the member table
115: */
116: private static java.util.Hashtable init() {
117: Hashtable members = new Hashtable();
118: members.put("public", PUBLIC);
119: members.put("protected", PROTECTED);
120: members.put("private", PRIVATE);
121: return members;
122: }
123:
124: /**
125: * Method readResolve. will be called during deserialization to
126: * replace the deserialized object with the correct constant
127: * instance.
128: *
129: * @return this deserialized object
130: */
131: private java.lang.Object readResolve() {
132: return valueOf(this .stringValue);
133: }
134:
135: /**
136: * Method toString.Returns the String representation of this
137: * FieldTypeVisibilityType
138: *
139: * @return the String representation of this
140: * FieldTypeVisibilityType
141: */
142: public java.lang.String toString() {
143: return this .stringValue;
144: }
145:
146: /**
147: * Method valueOf.Returns a new FieldTypeVisibilityType based
148: * on the given String value.
149: *
150: * @param string
151: * @return the FieldTypeVisibilityType value of parameter
152: * 'string'
153: */
154: public static org.exolab.castor.builder.binding.xml.types.FieldTypeVisibilityType valueOf(
155: final java.lang.String string) {
156: java.lang.Object obj = null;
157: if (string != null) {
158: obj = _memberTable.get(string);
159: }
160: if (obj == null) {
161: String err = "" + string
162: + " is not a valid FieldTypeVisibilityType";
163: throw new IllegalArgumentException(err);
164: }
165: return (FieldTypeVisibilityType) obj;
166: }
167:
168: }
|