KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > omg > CORBA > TCKind


1 /*
2  * @(#)TCKind.java 1.28 04/05/18
3  *
4  * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
5  * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
6  */

7
8 package org.omg.CORBA;
9
10
11 /**
12  * The Java mapping of the IDL enum <code>TCKind</code>, which
13  * specifies the kind of a <code>TypeCode</code> object. There is
14  * one kind for each primitive and essential IDL data type.
15  * <P>
16  * The class <code>TCKind</code> consists of:
17  * <UL>
18  * <LI>a set of <code>int</code> constants, one for each
19  * kind of IDL data type. These <code>int</code> constants
20  * make it possible to use a <code>switch</code> statement.
21  * <LI>a set of <code>TCKind</code> constants, one for each
22  * kind of IDL data type. The <code>value</code> field for
23  * each <code>TCKind</code> instance is initialized with
24  * the <code>int</code> constant that corresponds with
25  * the IDL data type that the instance represents.
26  * <LI>the method <code>from_int</code>for converting
27  * an <code>int</code> to its
28  * corresponding <code>TCKind</code> instance
29  * <P>Example:
30  * <PRE>
31  * org.omg.CORBA.TCKind k = org.omg.CORBA.TCKind.from_int(
32  * org.omg.CORBA.TCKind._tk_string);
33  * </PRE>
34  * The variable <code>k</code> represents the <code>TCKind</code>
35  * instance for the IDL type <code>string</code>, which is
36  * <code>tk_string</code>.
37  * <P>
38  * <LI>the method <code>value</code> for accessing the
39  * <code>_value</code> field of a <code>TCKind</code> constant
40  * <P>Example:
41  * <PRE>
42  * int i = org.omg.CORBA.TCKind.tk_char.value();
43  * </PRE>
44  * The variable <code>i</code> represents 9, the value for the
45  * IDL data type <code>char</code>.
46  * </UL>
47  * <P>The <code>value</code> field of a <code>TCKind</code> instance
48  * is the CDR encoding used for a <code>TypeCode</code> object in
49  * an IIOP message.
50  */

51
52 public class TCKind {
53
54     /**
55      * The <code>int</code> constant for a <code>null</code> IDL data type.
56      */

57     public static final int _tk_null = 0;
58
59     /**
60      * The <code>int</code> constant for the IDL data type <code>void</code>.
61      */

62     public static final int _tk_void = 1;
63
64     /**
65      * The <code>int</code> constant for the IDL data type <code>short</code>.
66      */

67     public static final int _tk_short = 2;
68
69     /**
70      * The <code>int</code> constant for the IDL data type <code>long</code>.
71      */

72     public static final int _tk_long = 3;
73
74     /**
75      * The <code>int</code> constant for the IDL data type <code>ushort</code>.
76      */

77     public static final int _tk_ushort = 4;
78
79     /**
80      * The <code>int</code> constant for the IDL data type <code>ulong</code>.
81      */

82     public static final int _tk_ulong = 5;
83
84     /**
85      * The <code>int</code> constant for the IDL data type <code>float</code>.
86      */

87     public static final int _tk_float = 6;
88
89     /**
90      * The <code>int</code> constant for the IDL data type <code>double</code>.
91      */

92     public static final int _tk_double = 7;
93
94     /**
95      * The <code>int</code> constant for the IDL data type <code>boolean</code>.
96      */

97     public static final int _tk_boolean = 8;
98
99     /**
100      * The <code>int</code> constant for the IDL data type <code>char</code>.
101      */

102     public static final int _tk_char = 9;
103
104     /**
105      * The <code>int</code> constant for the IDL data type <code>octet</code>.
106      */

107     public static final int _tk_octet = 10;
108
109     /**
110      * The <code>int</code> constant for the IDL data type <code>any</code>.
111      */

112     public static final int _tk_any = 11;
113
114     /**
115      * The <code>int</code> constant for the IDL data type <code>TypeCode</code>.
116      */

117     public static final int _tk_TypeCode = 12;
118
119     /**
120      * The <code>int</code> constant for the IDL data type <code>Principal</code>.
121      */

122     public static final int _tk_Principal = 13;
123
124     /**
125      * The <code>int</code> constant for the IDL data type <code>objref</code>.
126      */

127     public static final int _tk_objref = 14;
128
129     /**
130      * The <code>int</code> constant for the IDL data type <code>struct</code>.
131      */

132     public static final int _tk_struct = 15;
133
134     /**
135      * The <code>int</code> constant for the IDL data type <code>union</code>.
136      */

137     public static final int _tk_union = 16;
138
139     /**
140      * The <code>int</code> constant for the IDL data type <code>enum</code>.
141      */

142     public static final int _tk_enum = 17;
143
144     /**
145      * The <code>int</code> constant for the IDL data type <code>string</code>.
146      */

147     public static final int _tk_string = 18;
148
149     /**
150      * The <code>int</code> constant for the IDL data type <code>sequence</code>.
151      */

152     public static final int _tk_sequence = 19;
153
154     /**
155      * The <code>int</code> constant for the IDL data type <code>array</code>.
156      */

157     public static final int _tk_array = 20;
158
159     /**
160      * The <code>int</code> constant for the IDL data type <code>alias</code>.
161      */

162     public static final int _tk_alias = 21;
163
164     /**
165      * The <code>int</code> constant for the IDL data type <code>except</code>.
166      */

167     public static final int _tk_except = 22;
168
169     /**
170      * The <code>int</code> constant for the IDL data type <code>longlong</code>.
171      */

172     public static final int _tk_longlong = 23;
173
174     /**
175      * The <code>int</code> constant for the IDL data type <code>ulonglong</code>.
176      */

177     public static final int _tk_ulonglong = 24;
178
179     /**
180      * The <code>int</code> constant for the IDL data type <code>longdouble</code>.
181      */

182     public static final int _tk_longdouble = 25;
183
184     /**
185      * The <code>int</code> constant for the IDL data type <code>wchar</code>.
186      */

187     public static final int _tk_wchar = 26;
188
189     /**
190      * The <code>int</code> constant for the IDL data type <code>wstring</code>.
191      */

192     public static final int _tk_wstring = 27;
193
194     /**
195      * The <code>int</code> constant for the IDL data type <code>fixed</code>.
196      */

197     public static final int _tk_fixed = 28;
198
199     /**
200      * The <code>int</code> constant for the IDL data type <code>value</code>.
201      */

202     public static final int _tk_value = 29; // orbos 98-01-18: Objects By Value
203

204     /**
205      * The <code>int</code> constant for the IDL data type <code>value_box</code>.
206      */

207     public static final int _tk_value_box = 30; // orbos 98-01-18: Objects By Value
208

209     /**
210      * The <code>int</code> constant for the IDL data type <code>native</code>.
211      */

212     public static final int _tk_native = 31; // Verify
213

214     /**
215      * The <code>int</code> constant for the IDL data type <code>abstract interface</code>.
216      */

217     public static final int _tk_abstract_interface = 32;
218
219
220     /**
221      * The <code>TCKind</code> constant whose <code>value</code> field is
222      * initialized with <code>TCKind._tk_null</code>.
223      */

224     public static final TCKind JavaDoc tk_null = new TCKind JavaDoc(_tk_null);
225
226     /**
227      * The <code>TCKind</code> constant whose <code>value</code> field is
228      * initialized with <code>TCKind._tk_void</code>.
229      */

230     public static final TCKind JavaDoc tk_void = new TCKind JavaDoc(_tk_void);
231
232     /**
233      * The <code>TCKind</code> constant whose <code>value</code> field is
234      * initialized with <code>TCKind._tk_short</code>.
235      */

236     public static final TCKind JavaDoc tk_short = new TCKind JavaDoc(_tk_short);
237
238     /**
239      * The <code>TCKind</code> constant whose <code>value</code> field is
240      * initialized with <code>TCKind._tk_long</code>.
241      */

242     public static final TCKind JavaDoc tk_long = new TCKind JavaDoc(_tk_long);
243
244     /**
245      * The <code>TCKind</code> constant whose <code>value</code> field is
246      * initialized with <code>TCKind._tk_ushort</code>.
247      */

248     public static final TCKind JavaDoc tk_ushort = new TCKind JavaDoc(_tk_ushort);
249
250     /**
251      * The <code>TCKind</code> constant whose <code>value</code> field is
252      * initialized with <code>TCKind._tk_ulong</code>.
253      */

254     public static final TCKind JavaDoc tk_ulong = new TCKind JavaDoc(_tk_ulong);
255
256     /**
257      * The <code>TCKind</code> constant whose <code>value</code> field is
258      * initialized with <code>TCKind._tk_float</code>.
259      */

260     public static final TCKind JavaDoc tk_float = new TCKind JavaDoc(_tk_float);
261
262     /**
263      * The <code>TCKind</code> constant whose <code>value</code> field is
264      * initialized with <code>TCKind._tk_double</code>.
265      */

266     public static final TCKind JavaDoc tk_double = new TCKind JavaDoc(_tk_double);
267
268     /**
269      * The <code>TCKind</code> constant whose <code>value</code> field is
270      * initialized with <code>TCKind._tk_boolean</code>.
271      */

272     public static final TCKind JavaDoc tk_boolean = new TCKind JavaDoc(_tk_boolean);
273
274     /**
275      * The <code>TCKind</code> constant whose <code>value</code> field is
276      * initialized with <code>TCKind._tk_char</code>.
277      */

278     public static final TCKind JavaDoc tk_char = new TCKind JavaDoc(_tk_char);
279
280     /**
281      * The <code>TCKind</code> constant whose <code>value</code> field is
282      * initialized with <code>TCKind._tk_octet</code>.
283      */

284     public static final TCKind JavaDoc tk_octet = new TCKind JavaDoc(_tk_octet);
285
286     /**
287      * The <code>TCKind</code> constant whose <code>value</code> field is
288      * initialized with <code>TCKind._tk_any</code>.
289      */

290     public static final TCKind JavaDoc tk_any = new TCKind JavaDoc(_tk_any);
291
292     /**
293      * The <code>TCKind</code> constant whose <code>value</code> field is
294      * initialized with <code>TCKind._tk_TypeCode</code>.
295      */

296     public static final TCKind JavaDoc tk_TypeCode = new TCKind JavaDoc(_tk_TypeCode);
297
298     /**
299      * The <code>TCKind</code> constant whose <code>value</code> field is
300      * initialized with <code>TCKind._tk_Principal</code>.
301      */

302     public static final TCKind JavaDoc tk_Principal = new TCKind JavaDoc(_tk_Principal);
303
304     /**
305      * The <code>TCKind</code> constant whose <code>value</code> field is
306      * initialized with <code>TCKind._tk_objref</code>.
307      */

308     public static final TCKind JavaDoc tk_objref = new TCKind JavaDoc(_tk_objref);
309
310     /**
311      * The <code>TCKind</code> constant whose <code>value</code> field is
312      * initialized with <code>TCKind._tk_struct</code>.
313      */

314     public static final TCKind JavaDoc tk_struct = new TCKind JavaDoc(_tk_struct);
315
316     /**
317      * The <code>TCKind</code> constant whose <code>value</code> field is
318      * initialized with <code>TCKind._tk_union</code>.
319      */

320     public static final TCKind JavaDoc tk_union = new TCKind JavaDoc(_tk_union);
321
322     /**
323      * The <code>TCKind</code> constant whose <code>value</code> field is
324      * initialized with <code>TCKind._tk_enum</code>.
325      */

326     public static final TCKind JavaDoc tk_enum = new TCKind JavaDoc(_tk_enum);
327
328     /**
329      * The <code>TCKind</code> constant whose <code>value</code> field is
330      * initialized with <code>TCKind._tk_string</code>.
331      */

332     public static final TCKind JavaDoc tk_string = new TCKind JavaDoc(_tk_string);
333
334     /**
335      * The <code>TCKind</code> constant whose <code>value</code> field is
336      * initialized with <code>TCKind._tk_sequence</code>.
337      */

338     public static final TCKind JavaDoc tk_sequence = new TCKind JavaDoc(_tk_sequence);
339
340     /**
341      * The <code>TCKind</code> constant whose <code>value</code> field is
342      * initialized with <code>TCKind._tk_array</code>.
343      */

344     public static final TCKind JavaDoc tk_array = new TCKind JavaDoc(_tk_array);
345
346     /**
347      * The <code>TCKind</code> constant whose <code>value</code> field is
348      * initialized with <code>TCKind._tk_alias</code>.
349      */

350     public static final TCKind JavaDoc tk_alias = new TCKind JavaDoc(_tk_alias);
351
352     /**
353      * The <code>TCKind</code> constant whose <code>value</code> field is
354      * initialized with <code>TCKind._tk_except</code>.
355      */

356     public static final TCKind JavaDoc tk_except = new TCKind JavaDoc(_tk_except);
357
358     /**
359      * The <code>TCKind</code> constant whose <code>value</code> field is
360      * initialized with <code>TCKind._tk_longlong</code>.
361      */

362     public static final TCKind JavaDoc tk_longlong = new TCKind JavaDoc(_tk_longlong);
363
364     /**
365      * The <code>TCKind</code> constant whose <code>value</code> field is
366      * initialized with <code>TCKind._tk_ulonglong</code>.
367      */

368     public static final TCKind JavaDoc tk_ulonglong = new TCKind JavaDoc(_tk_ulonglong);
369
370     /**
371      * The <code>TCKind</code> constant whose <code>value</code> field is
372      * initialized with <code>TCKind._tk_longdouble</code>.
373      */

374     public static final TCKind JavaDoc tk_longdouble = new TCKind JavaDoc(_tk_longdouble);
375
376     /**
377      * The <code>TCKind</code> constant whose <code>value</code> field is
378      * initialized with <code>TCKind._tk_wchar</code>.
379      */

380     public static final TCKind JavaDoc tk_wchar = new TCKind JavaDoc(_tk_wchar);
381
382     /**
383      * The <code>TCKind</code> constant whose <code>value</code> field is
384      * initialized with <code>TCKind._tk_wstring</code>.
385      */

386     public static final TCKind JavaDoc tk_wstring = new TCKind JavaDoc(_tk_wstring);
387
388     /**
389      * The <code>TCKind</code> constant whose <code>value</code> field is
390      * initialized with <code>TCKind._tk_fixed</code>.
391      */

392     public static final TCKind JavaDoc tk_fixed = new TCKind JavaDoc(_tk_fixed);
393
394     // orbos 98-01-18: Objects By Value -- begin
395

396     /**
397      * The <code>TCKind</code> constant whose <code>value</code> field is
398      * initialized with <code>TCKind._tk_value</code>.
399      */

400     public static final TCKind JavaDoc tk_value = new TCKind JavaDoc(_tk_value);
401
402     /**
403      * The <code>TCKind</code> constant whose <code>value</code> field is
404      * initialized with <code>TCKind._tk_value_box</code>.
405      */

406     public static final TCKind JavaDoc tk_value_box = new TCKind JavaDoc(_tk_value_box);
407     // orbos 98-01-18: Objects By Value -- end
408

409     /**
410      * The <code>TCKind</code> constant whose <code>value</code> field is
411      * initialized with <code>TCKind._tk_native</code>.
412      */

413     public static final TCKind JavaDoc tk_native = new TCKind JavaDoc(_tk_native);
414     
415     /**
416      * The <code>TCKind</code> constant whose <code>value</code> field is
417      * initialized with <code>TCKind._tk_abstract_interface</code>.
418      */

419     public static final TCKind JavaDoc tk_abstract_interface = new TCKind JavaDoc(_tk_abstract_interface);
420
421
422
423
424     /**
425      * Retrieves the value of this <code>TCKind</code> instance.
426      *
427      * @return the <code>int</code> that represents the kind of
428      * IDL data type for this <code>TCKind</code> instance
429      */

430     public int value() {
431     return _value;
432     }
433
434     /**
435      * Converts the given <code>int</code> to the corresponding
436      * <code>TCKind</code> instance.
437      *
438      * @param i the <code>int</code> to convert. It must be one of
439      * the <code>int</code> constants in the class
440      * <code>TCKind</code>.
441      * @return the <code>TCKind</code> instance whose <code>value</code>
442      * field matches the given <code>int</code>
443      * @exception BAD_PARAM if the given <code>int</code> does not
444      * match the <code>_value</code> field of
445      * any <code>TCKind</code> instance
446      */

447     public static TCKind JavaDoc from_int(int i) {
448     switch (i) {
449     case _tk_null:
450         return tk_null;
451     case _tk_void:
452         return tk_void;
453     case _tk_short:
454         return tk_short;
455     case _tk_long:
456         return tk_long;
457     case _tk_ushort:
458         return tk_ushort;
459     case _tk_ulong:
460         return tk_ulong;
461     case _tk_float:
462         return tk_float;
463     case _tk_double:
464         return tk_double;
465     case _tk_boolean:
466         return tk_boolean;
467     case _tk_char:
468         return tk_char;
469     case _tk_octet:
470         return tk_octet;
471     case _tk_any:
472         return tk_any;
473     case _tk_TypeCode:
474         return tk_TypeCode;
475     case _tk_Principal:
476         return tk_Principal;
477     case _tk_objref:
478         return tk_objref;
479     case _tk_struct:
480         return tk_struct;
481     case _tk_union:
482         return tk_union;
483     case _tk_enum:
484         return tk_enum;
485     case _tk_string:
486         return tk_string;
487     case _tk_sequence:
488         return tk_sequence;
489     case _tk_array:
490         return tk_array;
491     case _tk_alias:
492         return tk_alias;
493     case _tk_except:
494         return tk_except;
495     case _tk_longlong:
496         return tk_longlong;
497     case _tk_ulonglong:
498         return tk_ulonglong;
499     case _tk_longdouble:
500         return tk_longdouble;
501     case _tk_wchar:
502         return tk_wchar;
503     case _tk_wstring:
504         return tk_wstring;
505     case _tk_fixed:
506         return tk_fixed;
507     case _tk_value: // orbos 98-01-18: Objects By Value
508
return tk_value;
509     case _tk_value_box: // orbos 98-01-18: Objects By Value
510
return tk_value_box;
511         case _tk_native:
512             return tk_native;
513         case _tk_abstract_interface:
514             return tk_abstract_interface;
515     default:
516         throw new org.omg.CORBA.BAD_PARAM JavaDoc();
517     }
518     }
519
520
521     /**
522     * Creates a new <code>TCKind</code> instance initialized with the given
523     * <code>int</code>.
524     * @deprecated Do not use this constructor as this method should be private
525     * according to the OMG specification. Use {@link #from_int(int)} instead.
526     *
527     * @param _value the <code>int</code> to convert. It must be one of
528     * the <code>int</code> constants in the class
529     * <code>TCKind</code>.
530     * @return a new <code>TCKind</code> instance whose <code>value</code>
531     * field matches the given <code>int</code>
532     */

533     @Deprecated JavaDoc
534     protected TCKind(int _value){
535     this._value = _value;
536     }
537     private int _value;
538 }
539
Popular Tags