KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > axis > client > async > Status


1 /*
2  * Copyright 2001-2004 The Apache Software Foundation.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */

16 package org.apache.axis.client.async;
17
18 import org.apache.axis.constants.Enum;
19
20 /**
21  * Status of the async request
22  *
23  * @author Davanum Srinivas (dims@yahoo.com)
24  */

25 public class Status extends Enum JavaDoc {
26
27     /**
28      * Field type
29      */

30     private static final Type type = new Type();
31
32     /**
33      * Field NONE_STR
34      */

35     public static final String JavaDoc NONE_STR = "none";
36
37     /**
38      * Field INTERRUPTED_STR
39      */

40     public static final String JavaDoc INTERRUPTED_STR = "interrupted";
41
42     /**
43      * Field COMPLETED_STR
44      */

45     public static final String JavaDoc COMPLETED_STR = "completed";
46
47     /**
48      * Field EXCEPTION_STR
49      */

50     public static final String JavaDoc EXCEPTION_STR = "exception";
51
52     /**
53      * Field NONE
54      */

55     public static final Status NONE = type.getStatus(NONE_STR);
56
57     /**
58      * Field INTERRUPTED
59      */

60     public static final Status INTERRUPTED = type.getStatus(INTERRUPTED_STR);
61
62     /**
63      * Field COMPLETED
64      */

65     public static final Status COMPLETED = type.getStatus(COMPLETED_STR);
66
67     /**
68      * Field EXCEPTION
69      */

70     public static final Status EXCEPTION = type.getStatus(EXCEPTION_STR);
71
72     /**
73      * Field DEFAULT
74      */

75     public static final Status DEFAULT = NONE;
76
77     static {
78         type.setDefault(DEFAULT);
79     }
80
81     /**
82      * Method getDefault
83      *
84      * @return
85      */

86     public static Status getDefault() {
87         return (Status) type.getDefault();
88     }
89
90     /**
91      * Method getStatus
92      *
93      * @param style
94      * @return
95      */

96     public static final Status getStatus(int style) {
97         return type.getStatus(style);
98     }
99
100     /**
101      * Method getStatus
102      *
103      * @param style
104      * @return
105      */

106     public static final Status getStatus(String JavaDoc style) {
107         return type.getStatus(style);
108     }
109
110     /**
111      * Method getStatus
112      *
113      * @param style
114      * @param dephault
115      * @return
116      */

117     public static final Status getStatus(String JavaDoc style, Status dephault) {
118         return type.getStatus(style, dephault);
119     }
120
121     /**
122      * Method isValid
123      *
124      * @param style
125      * @return
126      */

127     public static final boolean isValid(String JavaDoc style) {
128         return type.isValid(style);
129     }
130
131     /**
132      * Method size
133      *
134      * @return
135      */

136     public static final int size() {
137         return type.size();
138     }
139
140     /**
141      * Method getUses
142      *
143      * @return
144      */

145     public static final String JavaDoc[] getUses() {
146         return type.getEnumNames();
147     }
148
149     /**
150      * Class Type
151      *
152      * @author
153      * @version %I%, %G%
154      */

155     public static class Type extends Enum.Type JavaDoc {
156
157         /**
158          * Constructor Type
159          */

160         private Type() {
161
162             super("status", new Enum JavaDoc[]{new Status(0, NONE_STR),
163                                        new Status(1, INTERRUPTED_STR),
164                                        new Status(2, COMPLETED_STR),
165                                        new Status(3, EXCEPTION_STR), });
166         }
167
168         /**
169          * Method getStatus
170          *
171          * @param status
172          * @return
173          */

174         public final Status getStatus(int status) {
175             return (Status) this.getEnum(status);
176         }
177
178         /**
179          * Method getStatus
180          *
181          * @param status
182          * @return
183          */

184         public final Status getStatus(String JavaDoc status) {
185             return (Status) this.getEnum(status);
186         }
187
188         /**
189          * Method getStatus
190          *
191          * @param status
192          * @param dephault
193          * @return
194          */

195         public final Status getStatus(String JavaDoc status, Status dephault) {
196             return (Status) this.getEnum(status, dephault);
197         }
198     }
199
200     /**
201      * Constructor Status
202      *
203      * @param value
204      * @param name
205      */

206     private Status(int value, String JavaDoc name) {
207         super(type, value, name);
208     }
209 }
210
Popular Tags