KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > javax > enterprise > deploy > shared > DConfigBeanVersionType


1 /*
2  * The contents of this file are subject to the terms
3  * of the Common Development and Distribution License
4  * (the License). You may not use this file except in
5  * compliance with the License.
6  *
7  * You can obtain a copy of the license at
8  * https://glassfish.dev.java.net/public/CDDLv1.0.html or
9  * glassfish/bootstrap/legal/CDDLv1.0.txt.
10  * See the License for the specific language governing
11  * permissions and limitations under the License.
12  *
13  * When distributing Covered Code, include this CDDL
14  * Header Notice in each file and include the License file
15  * at glassfish/bootstrap/legal/CDDLv1.0.txt.
16  * If applicable, add the following below the CDDL Header,
17  * with the fields enclosed by brackets [] replaced by
18  * you own identifying information:
19  * "Portions Copyrighted [year] [name of copyright owner]"
20  *
21  * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
22  */

23
24 package javax.enterprise.deploy.shared;
25
26 /**
27  * Class DConfigBeanVersionTypes defines enumeration values for the J2EE
28  * Platform verion number.
29  *
30  * @author rsearls
31  */

32 public class DConfigBeanVersionType
33 {
34     private int value; // This enumeration value's int value
35

36     /**
37      * J2EE Platform version 1.3
38      */

39     public static final DConfigBeanVersionType JavaDoc V1_3 =
40         new DConfigBeanVersionType JavaDoc(0);
41
42     /**
43      * J2EE Platform version 1.3.1
44      * THIS CONSTANT SHOULD NEVER BE USED. Use V1_3 instead.
45      */

46     public static final DConfigBeanVersionType JavaDoc V1_3_1 =
47         new DConfigBeanVersionType JavaDoc(1);
48
49     /**
50      * J2EE Platform version 1.4
51      */

52     public static final DConfigBeanVersionType JavaDoc V1_4 =
53         new DConfigBeanVersionType JavaDoc(2);
54
55     /**
56      * Java EE Platform version 5
57      */

58     public static final DConfigBeanVersionType JavaDoc V5 =
59             new DConfigBeanVersionType JavaDoc(3);
60
61     private static final String JavaDoc[] stringTable = {
62     "V1_3",
63     "V1_3_1",
64     "V1_4",
65         "V5"
66     };
67
68     private static final DConfigBeanVersionType JavaDoc[] enumValueTable = {
69     V1_3,
70     V1_3_1,
71     V1_4,
72         V5
73     };
74
75
76     /**
77      * Construct a new enumeration value with the given integer value.
78      *
79      * @param value Integer value.
80      */

81     protected DConfigBeanVersionType(int value)
82     { this.value = value;
83     }
84
85     /**
86      * Returns this enumeration value's integer value.
87      * @return the value
88      */

89     public int getValue()
90     { return value;
91     }
92
93        
94     /**
95      * Returns the string table for class DConfigBeanVersionType
96      */

97     protected String JavaDoc[] getStringTable()
98     {
99         return stringTable;
100     }
101
102     /**
103      * Returns the enumeration value table for class DConfigBeanVersionType
104      */

105     protected DConfigBeanVersionType JavaDoc[] getEnumValueTable()
106     {
107         return enumValueTable;
108     }
109
110     /**
111      * Return an object of the specified value.
112      * @param value a designator for the object.
113      */

114     public static DConfigBeanVersionType JavaDoc getDConfigBeanVersionType(int value)
115     { return enumValueTable[value];
116     }
117
118     /**
119      * Return the string name of this DConfigBeanVersionType or the
120      * integer value if outside the bounds of the table
121      */

122     public String JavaDoc toString()
123     {
124         String JavaDoc[] strTable = getStringTable();
125         int index = value - getOffset();
126         if (strTable != null && index >= 0 && index < strTable.length)
127             return strTable[index];
128         else
129             return Integer.toString (value);
130     }
131
132     /**
133      * Returns the lowest integer value used by this enumeration value's
134      * enumeration class.
135      * <P>
136      * The default implementation returns 0.
137      * @return the offset of the lowest enumeration value.
138      */

139     protected int getOffset()
140     { return 0;
141     }
142 }
143
Popular Tags