Source code: javax/enterprise/deploy/shared/ActionType.java
1 /**
2 *
3 * Copyright 2003-2004 The Apache Software Foundation
4 *
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
8 *
9 * http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 */
17
18 //
19 // This source code implements specifications defined by the Java
20 // Community Process. In order to remain compliant with the specification
21 // DO NOT add / change / or delete method signatures!
22 //
23
24 package javax.enterprise.deploy.shared;
25
26 /**
27 * Class ActionTypes defines enumeration values for the J2EE DeploymentStatus
28 * actions.
29 *
30 * @version $Rev: 46019 $ $Date: 2004-09-14 02:56:06 -0700 (Tue, 14 Sep 2004) $
31 */
32 public class ActionType {
33 /**
34 * The action is currently executing.
35 */
36 public static final ActionType EXECUTE = new ActionType(0);
37 /**
38 * The action has been canceled.
39 */
40 public static final ActionType CANCEL = new ActionType(1);
41 /**
42 * A stop operation is being performed on the DeploymentManager action command.
43 */
44 public static final ActionType STOP = new ActionType(2);
45
46 private static final ActionType[] enumValueTable = new ActionType[]{
47 EXECUTE,
48 CANCEL,
49 STOP,
50 };
51
52 private static final String[] stringTable = new String[]{
53 "execute",
54 "cancel",
55 "stop",
56 };
57
58 private int value;
59
60 /**
61 * Construct a new enumeration value with the given integer value.
62 */
63 protected ActionType(int value) {
64 this.value = value;
65 }
66
67 /**
68 * Returns this enumeration value's integer value.
69 *
70 * @return the value
71 */
72 public int getValue() {
73 return value;
74 }
75
76 /**
77 * Returns the string table for class ActionType
78 */
79 protected String[] getStringTable() {
80 return stringTable;
81 }
82
83 /**
84 * Returns the enumeration value table for class ActionType
85 */
86 protected ActionType[] getEnumValueTable() {
87 return enumValueTable;
88 }
89
90 /**
91 * Return an object of the specified value.
92 *
93 * @param value a designator for the object.
94 */
95 public static ActionType getActionType(int value) {
96 return enumValueTable[value];
97 }
98
99 /**
100 * Return the string name of this ActionType or the integer value if
101 * outside the bounds of the table
102 */
103 public String toString() {
104 return (value >= 0 && value <= 2) ? stringTable[value] : String.valueOf(value);
105 }
106
107 /**
108 * Returns the lowest integer value used by this enumeration value's
109 * enumeration class.
110 *
111 * @return the offset of the lowest enumeration value.
112 */
113 protected int getOffset() {
114 return 0;
115 }
116 }