View Javadoc

1   /*
2    * This class was automatically generated with 
3    * <a href="http://www.castor.org">Castor 0.9.7</a>, using an XML
4    * Schema.
5    * $Id$
6    */
7   
8   package fr.in2p3.jsaga.engine.schema.config.types;
9   
10    //---------------------------------/
11   //- Imported classes and packages -/
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   * Class ProtectionLevelType.
22   * 
23   * @version $Revision$ $Date$
24   */
25  public class ProtectionLevelType implements java.io.Serializable {
26  
27  
28        //--------------------------/
29       //- Class/Member Variables -/
30      //--------------------------/
31  
32      /**
33       * The none type
34       */
35      public static final int NONE_TYPE = 0;
36  
37      /**
38       * The instance of the none type
39       */
40      public static final ProtectionLevelType NONE = new ProtectionLevelType(NONE_TYPE, "none");
41  
42      /**
43       * The integrity type
44       */
45      public static final int INTEGRITY_TYPE = 1;
46  
47      /**
48       * The instance of the integrity type
49       */
50      public static final ProtectionLevelType INTEGRITY = new ProtectionLevelType(INTEGRITY_TYPE, "integrity");
51  
52      /**
53       * The confidentiality type
54       */
55      public static final int CONFIDENTIALITY_TYPE = 2;
56  
57      /**
58       * The instance of the confidentiality type
59       */
60      public static final ProtectionLevelType CONFIDENTIALITY = new ProtectionLevelType(CONFIDENTIALITY_TYPE, "confidentiality");
61  
62      /**
63       * Field _memberTable
64       */
65      private static java.util.Hashtable _memberTable = init();
66  
67      /**
68       * Field type
69       */
70      private int type = -1;
71  
72      /**
73       * Field stringValue
74       */
75      private java.lang.String stringValue = null;
76  
77  
78        //----------------/
79       //- Constructors -/
80      //----------------/
81  
82      private ProtectionLevelType(int type, java.lang.String value) 
83       {
84          super();
85          this.type = type;
86          this.stringValue = value;
87      } //-- fr.in2p3.jsaga.engine.schema.config.types.ProtectionLevelType(int, java.lang.String)
88  
89  
90        //-----------/
91       //- Methods -/
92      //-----------/
93  
94      /**
95       * Method enumerate
96       * 
97       * Returns an enumeration of all possible instances of
98       * ProtectionLevelType
99       * 
100      * @return Enumeration
101      */
102     public static java.util.Enumeration enumerate()
103     {
104         return _memberTable.elements();
105     } //-- java.util.Enumeration enumerate() 
106 
107     /**
108      * Method getType
109      * 
110      * Returns the type of this ProtectionLevelType
111      * 
112      * @return int
113      */
114     public int getType()
115     {
116         return this.type;
117     } //-- int getType() 
118 
119     /**
120      * Method init
121      * 
122      * 
123      * 
124      * @return Hashtable
125      */
126     private static java.util.Hashtable init()
127     {
128         Hashtable members = new Hashtable();
129         members.put("none", NONE);
130         members.put("integrity", INTEGRITY);
131         members.put("confidentiality", CONFIDENTIALITY);
132         return members;
133     } //-- java.util.Hashtable init() 
134 
135     /**
136      * Method readResolve
137      * 
138      *  will be called during deserialization to replace the
139      * deserialized object with the correct constant instance.
140      * <br/>
141      * 
142      * @return Object
143      */
144     private java.lang.Object readResolve()
145     {
146         return valueOf(this.stringValue);
147     } //-- java.lang.Object readResolve() 
148 
149     /**
150      * Method toString
151      * 
152      * Returns the String representation of this
153      * ProtectionLevelType
154      * 
155      * @return String
156      */
157     public java.lang.String toString()
158     {
159         return this.stringValue;
160     } //-- java.lang.String toString() 
161 
162     /**
163      * Method valueOf
164      * 
165      * Returns a new ProtectionLevelType based on the given String
166      * value.
167      * 
168      * @param string
169      * @return ProtectionLevelType
170      */
171     public static fr.in2p3.jsaga.engine.schema.config.types.ProtectionLevelType valueOf(java.lang.String string)
172     {
173         java.lang.Object obj = null;
174         if (string != null) obj = _memberTable.get(string);
175         if (obj == null) {
176             String err = "'" + string + "' is not a valid ProtectionLevelType";
177             throw new IllegalArgumentException(err);
178         }
179         return (ProtectionLevelType) obj;
180     } //-- fr.in2p3.jsaga.engine.schema.config.types.ProtectionLevelType valueOf(java.lang.String) 
181 
182 }