1 23 24 package javax.enterprise.deploy.shared; 25 26 32 public class ModuleType 33 { 34 private int value; 36 39 public static final ModuleType EAR = new ModuleType (0); 40 43 public static final ModuleType EJB = new ModuleType (1); 44 47 public static final ModuleType CAR = new ModuleType (2); 48 51 public static final ModuleType RAR = new ModuleType (3); 52 55 public static final ModuleType WAR = new ModuleType (4); 56 57 58 private static final String [] stringTable = { 59 "ear", 60 "ejb", 61 "car", 62 "rar", 63 "war", 64 }; 65 66 private static final ModuleType [] enumValueTable = { 67 EAR, 68 EJB, 69 CAR, 70 RAR, 71 WAR, 72 }; 73 74 77 private static final String [] moduleExtension = { 78 ".ear", 79 ".jar", 80 ".jar", 81 ".rar", 82 ".war", 83 }; 84 85 86 91 protected ModuleType(int value) 92 { this.value = value; 93 } 94 95 99 public int getValue() 100 { return value; 101 } 102 103 104 107 protected String [] getStringTable() 108 { return stringTable; 109 } 110 111 114 protected ModuleType [] getEnumValueTable() 115 { return enumValueTable; 116 } 117 118 121 public String getModuleExtension() 122 { return (moduleExtension[getValue()]); 123 } 124 125 129 public static ModuleType getModuleType(int value) 130 { return enumValueTable[value]; 131 } 132 133 137 public String toString() 138 { 139 String [] strTable = getStringTable(); 140 int index = value - getOffset(); 141 if (strTable != null && index >= 0 && index < strTable.length) 142 return strTable[index]; 143 else 144 return Integer.toString (value); 145 } 146 147 157 protected int getOffset() 158 { return 0; 159 } 160 } 161 | Popular Tags |