001: /*
002: * JBoss, Home of Professional Open Source.
003: * Copyright 2006, Red Hat Middleware LLC, and individual contributors
004: * as indicated by the @author tags. See the copyright.txt file in the
005: * distribution for a full listing of individual contributors.
006: *
007: * This is free software; you can redistribute it and/or modify it
008: * under the terms of the GNU Lesser General Public License as
009: * published by the Free Software Foundation; either version 2.1 of
010: * the License, or (at your option) any later version.
011: *
012: * This software is distributed in the hope that it will be useful,
013: * but WITHOUT ANY WARRANTY; without even the implied warranty of
014: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
015: * Lesser General Public License for more details.
016: *
017: * You should have received a copy of the GNU Lesser General Public
018: * License along with this software; if not, write to the Free
019: * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
020: * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
021: */
022: package javax.enterprise.deploy.shared;
023:
024: /**
025: * An enumeration of deployment status action types.
026: *
027: * @author <a href="mailto:adrian@jboss.org">Adrian Brock</a>
028: * @version $Revision: 57196 $
029: */
030: public class DConfigBeanVersionType {
031: // Constants -----------------------------------------------------
032:
033: /** The 1.3 integer value */
034: private static final int V1_3_INT = 0;
035: /** The 1.3.1 integer value */
036: private static final int V1_3_1_INT = 1;
037: /** The 1.4 integer value */
038: private static final int V1_4_INT = 2;
039:
040: /** The version type for J2EE 1.3 */
041: public static final DConfigBeanVersionType V1_3 = new DConfigBeanVersionType(
042: V1_3_INT);
043: /** The version type for J2EE 1.3.1 - DO NOT USE */
044: public static final DConfigBeanVersionType V1_3_1 = new DConfigBeanVersionType(
045: V1_3_1_INT);
046: /** The version type for J2EE 1.4 */
047: public static final DConfigBeanVersionType V1_4 = new DConfigBeanVersionType(
048: V1_4_INT);
049:
050: /** The version types */
051: private static final DConfigBeanVersionType[] versionTypes = new DConfigBeanVersionType[] {
052: V1_3, V1_3_1, V1_4 };
053:
054: /** The version descriptions */
055: private static final String[] versionDescs = new String[] {
056: "J2EE 1.3", "J2EE 1.3.1 - DO NOT USE", "J2EE 1.4" };
057:
058: // Attributes ----------------------------------------------------
059:
060: /** The value */
061: private int value;
062:
063: /**
064: * Create a new DConfigBeanVersionType
065: *
066: * @param value the value
067: */
068: protected DConfigBeanVersionType(int value) {
069: this .value = value;
070: }
071:
072: // Public --------------------------------------------------------
073:
074: /**
075: * Get the value
076: *
077: * @return the value
078: */
079: public int getValue() {
080: return value;
081: }
082:
083: /**
084: * Get the string table for class DConfigBeanVersion type
085: *
086: * [todo] check this?
087: * @return the string table
088: */
089: protected String[] getStringTable() {
090: return versionDescs;
091: }
092:
093: /**
094: * Get the enumerated values for module type
095: *
096: * @return the string table
097: */
098: protected DConfigBeanVersionType[] getEnumValueTable() {
099: return versionTypes;
100: }
101:
102: /**
103: * Get the version type for an integer
104: *
105: * @param type the type
106: * @return the action type
107: */
108: public static DConfigBeanVersionType getDConfigBeanVersionType(
109: int type) {
110: if (type >= versionTypes.length)
111: return null;
112: return versionTypes[type];
113: }
114:
115: public String toString() {
116: return versionDescs[value];
117: }
118:
119: /**
120: * Return the offset of the first element
121: *
122: * @return the offset
123: */
124: protected int getOffset() {
125: return V1_3_INT;
126: }
127:
128: // Inner classes -------------------------------------------------
129: }
|