1 23 24 package javax.enterprise.deploy.shared; 25 26 32 public class ActionType 33 { 34 private int value; 36 39 public static final ActionType EXECUTE = new ActionType (0); 40 44 public static final ActionType CANCEL = new ActionType (1); 45 49 public static final ActionType STOP = new ActionType (2); 50 51 52 private static final String [] stringTable = { 53 "execute", 54 "cancel", 55 "stop", 56 }; 57 58 private static final ActionType [] enumValueTable = { 59 EXECUTE, 60 CANCEL, 61 STOP, 62 }; 63 64 65 70 protected ActionType(int value) 71 { this.value = value; 72 } 73 74 78 public int getValue() 79 { return value; 80 } 81 82 83 86 protected String [] getStringTable() 87 { 88 return stringTable; 89 } 90 91 94 protected ActionType [] getEnumValueTable() 95 { 96 return enumValueTable; 97 } 98 99 103 public static ActionType getActionType(int value) 104 { return enumValueTable[value]; 105 } 106 107 111 public String toString() 112 { 113 String [] strTable = getStringTable(); 114 int index = value - getOffset(); 115 if (strTable != null && index >= 0 && index < strTable.length) 116 return strTable[index]; 117 else 118 return Integer.toString (value); 119 } 120 121 128 protected int getOffset() 129 { return 0; 130 } 131 } 132 | Popular Tags |