Tue, 28 Dec 2010 15:52:36 -0800
6962318: Update copyright year
Reviewed-by: xdono
1 /*
2 * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. Oracle designates this
8 * particular file as subject to the "Classpath" exception as provided
9 * by Oracle in the LICENSE file that accompanied this code.
10 *
11 * This code is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
23 * questions.
24 */
26 package org.omg.CORBA;
29 /**
30 * The Java mapping of the IDL enum <code>TCKind</code>, which
31 * specifies the kind of a <code>TypeCode</code> object. There is
32 * one kind for each primitive and essential IDL data type.
33 * <P>
34 * The class <code>TCKind</code> consists of:
35 * <UL>
36 * <LI>a set of <code>int</code> constants, one for each
37 * kind of IDL data type. These <code>int</code> constants
38 * make it possible to use a <code>switch</code> statement.
39 * <LI>a set of <code>TCKind</code> constants, one for each
40 * kind of IDL data type. The <code>value</code> field for
41 * each <code>TCKind</code> instance is initialized with
42 * the <code>int</code> constant that corresponds with
43 * the IDL data type that the instance represents.
44 * <LI>the method <code>from_int</code>for converting
45 * an <code>int</code> to its
46 * corresponding <code>TCKind</code> instance
47 * <P>Example:
48 * <PRE>
49 * org.omg.CORBA.TCKind k = org.omg.CORBA.TCKind.from_int(
50 * org.omg.CORBA.TCKind._tk_string);
51 * </PRE>
52 * The variable <code>k</code> represents the <code>TCKind</code>
53 * instance for the IDL type <code>string</code>, which is
54 * <code>tk_string</code>.
55 * <P>
56 * <LI>the method <code>value</code> for accessing the
57 * <code>_value</code> field of a <code>TCKind</code> constant
58 * <P>Example:
59 * <PRE>
60 * int i = org.omg.CORBA.TCKind.tk_char.value();
61 * </PRE>
62 * The variable <code>i</code> represents 9, the value for the
63 * IDL data type <code>char</code>.
64 * </UL>
65 * <P>The <code>value</code> field of a <code>TCKind</code> instance
66 * is the CDR encoding used for a <code>TypeCode</code> object in
67 * an IIOP message.
68 */
70 public class TCKind {
72 /**
73 * The <code>int</code> constant for a <code>null</code> IDL data type.
74 */
75 public static final int _tk_null = 0;
77 /**
78 * The <code>int</code> constant for the IDL data type <code>void</code>.
79 */
80 public static final int _tk_void = 1;
82 /**
83 * The <code>int</code> constant for the IDL data type <code>short</code>.
84 */
85 public static final int _tk_short = 2;
87 /**
88 * The <code>int</code> constant for the IDL data type <code>long</code>.
89 */
90 public static final int _tk_long = 3;
92 /**
93 * The <code>int</code> constant for the IDL data type <code>ushort</code>.
94 */
95 public static final int _tk_ushort = 4;
97 /**
98 * The <code>int</code> constant for the IDL data type <code>ulong</code>.
99 */
100 public static final int _tk_ulong = 5;
102 /**
103 * The <code>int</code> constant for the IDL data type <code>float</code>.
104 */
105 public static final int _tk_float = 6;
107 /**
108 * The <code>int</code> constant for the IDL data type <code>double</code>.
109 */
110 public static final int _tk_double = 7;
112 /**
113 * The <code>int</code> constant for the IDL data type <code>boolean</code>.
114 */
115 public static final int _tk_boolean = 8;
117 /**
118 * The <code>int</code> constant for the IDL data type <code>char</code>.
119 */
120 public static final int _tk_char = 9;
122 /**
123 * The <code>int</code> constant for the IDL data type <code>octet</code>.
124 */
125 public static final int _tk_octet = 10;
127 /**
128 * The <code>int</code> constant for the IDL data type <code>any</code>.
129 */
130 public static final int _tk_any = 11;
132 /**
133 * The <code>int</code> constant for the IDL data type <code>TypeCode</code>.
134 */
135 public static final int _tk_TypeCode = 12;
137 /**
138 * The <code>int</code> constant for the IDL data type <code>Principal</code>.
139 */
140 public static final int _tk_Principal = 13;
142 /**
143 * The <code>int</code> constant for the IDL data type <code>objref</code>.
144 */
145 public static final int _tk_objref = 14;
147 /**
148 * The <code>int</code> constant for the IDL data type <code>struct</code>.
149 */
150 public static final int _tk_struct = 15;
152 /**
153 * The <code>int</code> constant for the IDL data type <code>union</code>.
154 */
155 public static final int _tk_union = 16;
157 /**
158 * The <code>int</code> constant for the IDL data type <code>enum</code>.
159 */
160 public static final int _tk_enum = 17;
162 /**
163 * The <code>int</code> constant for the IDL data type <code>string</code>.
164 */
165 public static final int _tk_string = 18;
167 /**
168 * The <code>int</code> constant for the IDL data type <code>sequence</code>.
169 */
170 public static final int _tk_sequence = 19;
172 /**
173 * The <code>int</code> constant for the IDL data type <code>array</code>.
174 */
175 public static final int _tk_array = 20;
177 /**
178 * The <code>int</code> constant for the IDL data type <code>alias</code>.
179 */
180 public static final int _tk_alias = 21;
182 /**
183 * The <code>int</code> constant for the IDL data type <code>except</code>.
184 */
185 public static final int _tk_except = 22;
187 /**
188 * The <code>int</code> constant for the IDL data type <code>longlong</code>.
189 */
190 public static final int _tk_longlong = 23;
192 /**
193 * The <code>int</code> constant for the IDL data type <code>ulonglong</code>.
194 */
195 public static final int _tk_ulonglong = 24;
197 /**
198 * The <code>int</code> constant for the IDL data type <code>longdouble</code>.
199 */
200 public static final int _tk_longdouble = 25;
202 /**
203 * The <code>int</code> constant for the IDL data type <code>wchar</code>.
204 */
205 public static final int _tk_wchar = 26;
207 /**
208 * The <code>int</code> constant for the IDL data type <code>wstring</code>.
209 */
210 public static final int _tk_wstring = 27;
212 /**
213 * The <code>int</code> constant for the IDL data type <code>fixed</code>.
214 */
215 public static final int _tk_fixed = 28;
217 /**
218 * The <code>int</code> constant for the IDL data type <code>value</code>.
219 */
220 public static final int _tk_value = 29; // orbos 98-01-18: Objects By Value
222 /**
223 * The <code>int</code> constant for the IDL data type <code>value_box</code>.
224 */
225 public static final int _tk_value_box = 30; // orbos 98-01-18: Objects By Value
227 /**
228 * The <code>int</code> constant for the IDL data type <code>native</code>.
229 */
230 public static final int _tk_native = 31; // Verify
232 /**
233 * The <code>int</code> constant for the IDL data type <code>abstract interface</code>.
234 */
235 public static final int _tk_abstract_interface = 32;
238 /**
239 * The <code>TCKind</code> constant whose <code>value</code> field is
240 * initialized with <code>TCKind._tk_null</code>.
241 */
242 public static final TCKind tk_null = new TCKind(_tk_null);
244 /**
245 * The <code>TCKind</code> constant whose <code>value</code> field is
246 * initialized with <code>TCKind._tk_void</code>.
247 */
248 public static final TCKind tk_void = new TCKind(_tk_void);
250 /**
251 * The <code>TCKind</code> constant whose <code>value</code> field is
252 * initialized with <code>TCKind._tk_short</code>.
253 */
254 public static final TCKind tk_short = new TCKind(_tk_short);
256 /**
257 * The <code>TCKind</code> constant whose <code>value</code> field is
258 * initialized with <code>TCKind._tk_long</code>.
259 */
260 public static final TCKind tk_long = new TCKind(_tk_long);
262 /**
263 * The <code>TCKind</code> constant whose <code>value</code> field is
264 * initialized with <code>TCKind._tk_ushort</code>.
265 */
266 public static final TCKind tk_ushort = new TCKind(_tk_ushort);
268 /**
269 * The <code>TCKind</code> constant whose <code>value</code> field is
270 * initialized with <code>TCKind._tk_ulong</code>.
271 */
272 public static final TCKind tk_ulong = new TCKind(_tk_ulong);
274 /**
275 * The <code>TCKind</code> constant whose <code>value</code> field is
276 * initialized with <code>TCKind._tk_float</code>.
277 */
278 public static final TCKind tk_float = new TCKind(_tk_float);
280 /**
281 * The <code>TCKind</code> constant whose <code>value</code> field is
282 * initialized with <code>TCKind._tk_double</code>.
283 */
284 public static final TCKind tk_double = new TCKind(_tk_double);
286 /**
287 * The <code>TCKind</code> constant whose <code>value</code> field is
288 * initialized with <code>TCKind._tk_boolean</code>.
289 */
290 public static final TCKind tk_boolean = new TCKind(_tk_boolean);
292 /**
293 * The <code>TCKind</code> constant whose <code>value</code> field is
294 * initialized with <code>TCKind._tk_char</code>.
295 */
296 public static final TCKind tk_char = new TCKind(_tk_char);
298 /**
299 * The <code>TCKind</code> constant whose <code>value</code> field is
300 * initialized with <code>TCKind._tk_octet</code>.
301 */
302 public static final TCKind tk_octet = new TCKind(_tk_octet);
304 /**
305 * The <code>TCKind</code> constant whose <code>value</code> field is
306 * initialized with <code>TCKind._tk_any</code>.
307 */
308 public static final TCKind tk_any = new TCKind(_tk_any);
310 /**
311 * The <code>TCKind</code> constant whose <code>value</code> field is
312 * initialized with <code>TCKind._tk_TypeCode</code>.
313 */
314 public static final TCKind tk_TypeCode = new TCKind(_tk_TypeCode);
316 /**
317 * The <code>TCKind</code> constant whose <code>value</code> field is
318 * initialized with <code>TCKind._tk_Principal</code>.
319 */
320 public static final TCKind tk_Principal = new TCKind(_tk_Principal);
322 /**
323 * The <code>TCKind</code> constant whose <code>value</code> field is
324 * initialized with <code>TCKind._tk_objref</code>.
325 */
326 public static final TCKind tk_objref = new TCKind(_tk_objref);
328 /**
329 * The <code>TCKind</code> constant whose <code>value</code> field is
330 * initialized with <code>TCKind._tk_struct</code>.
331 */
332 public static final TCKind tk_struct = new TCKind(_tk_struct);
334 /**
335 * The <code>TCKind</code> constant whose <code>value</code> field is
336 * initialized with <code>TCKind._tk_union</code>.
337 */
338 public static final TCKind tk_union = new TCKind(_tk_union);
340 /**
341 * The <code>TCKind</code> constant whose <code>value</code> field is
342 * initialized with <code>TCKind._tk_enum</code>.
343 */
344 public static final TCKind tk_enum = new TCKind(_tk_enum);
346 /**
347 * The <code>TCKind</code> constant whose <code>value</code> field is
348 * initialized with <code>TCKind._tk_string</code>.
349 */
350 public static final TCKind tk_string = new TCKind(_tk_string);
352 /**
353 * The <code>TCKind</code> constant whose <code>value</code> field is
354 * initialized with <code>TCKind._tk_sequence</code>.
355 */
356 public static final TCKind tk_sequence = new TCKind(_tk_sequence);
358 /**
359 * The <code>TCKind</code> constant whose <code>value</code> field is
360 * initialized with <code>TCKind._tk_array</code>.
361 */
362 public static final TCKind tk_array = new TCKind(_tk_array);
364 /**
365 * The <code>TCKind</code> constant whose <code>value</code> field is
366 * initialized with <code>TCKind._tk_alias</code>.
367 */
368 public static final TCKind tk_alias = new TCKind(_tk_alias);
370 /**
371 * The <code>TCKind</code> constant whose <code>value</code> field is
372 * initialized with <code>TCKind._tk_except</code>.
373 */
374 public static final TCKind tk_except = new TCKind(_tk_except);
376 /**
377 * The <code>TCKind</code> constant whose <code>value</code> field is
378 * initialized with <code>TCKind._tk_longlong</code>.
379 */
380 public static final TCKind tk_longlong = new TCKind(_tk_longlong);
382 /**
383 * The <code>TCKind</code> constant whose <code>value</code> field is
384 * initialized with <code>TCKind._tk_ulonglong</code>.
385 */
386 public static final TCKind tk_ulonglong = new TCKind(_tk_ulonglong);
388 /**
389 * The <code>TCKind</code> constant whose <code>value</code> field is
390 * initialized with <code>TCKind._tk_longdouble</code>.
391 */
392 public static final TCKind tk_longdouble = new TCKind(_tk_longdouble);
394 /**
395 * The <code>TCKind</code> constant whose <code>value</code> field is
396 * initialized with <code>TCKind._tk_wchar</code>.
397 */
398 public static final TCKind tk_wchar = new TCKind(_tk_wchar);
400 /**
401 * The <code>TCKind</code> constant whose <code>value</code> field is
402 * initialized with <code>TCKind._tk_wstring</code>.
403 */
404 public static final TCKind tk_wstring = new TCKind(_tk_wstring);
406 /**
407 * The <code>TCKind</code> constant whose <code>value</code> field is
408 * initialized with <code>TCKind._tk_fixed</code>.
409 */
410 public static final TCKind tk_fixed = new TCKind(_tk_fixed);
412 // orbos 98-01-18: Objects By Value -- begin
414 /**
415 * The <code>TCKind</code> constant whose <code>value</code> field is
416 * initialized with <code>TCKind._tk_value</code>.
417 */
418 public static final TCKind tk_value = new TCKind(_tk_value);
420 /**
421 * The <code>TCKind</code> constant whose <code>value</code> field is
422 * initialized with <code>TCKind._tk_value_box</code>.
423 */
424 public static final TCKind tk_value_box = new TCKind(_tk_value_box);
425 // orbos 98-01-18: Objects By Value -- end
427 /**
428 * The <code>TCKind</code> constant whose <code>value</code> field is
429 * initialized with <code>TCKind._tk_native</code>.
430 */
431 public static final TCKind tk_native = new TCKind(_tk_native);
433 /**
434 * The <code>TCKind</code> constant whose <code>value</code> field is
435 * initialized with <code>TCKind._tk_abstract_interface</code>.
436 */
437 public static final TCKind tk_abstract_interface = new TCKind(_tk_abstract_interface);
442 /**
443 * Retrieves the value of this <code>TCKind</code> instance.
444 *
445 * @return the <code>int</code> that represents the kind of
446 * IDL data type for this <code>TCKind</code> instance
447 */
448 public int value() {
449 return _value;
450 }
452 /**
453 * Converts the given <code>int</code> to the corresponding
454 * <code>TCKind</code> instance.
455 *
456 * @param i the <code>int</code> to convert. It must be one of
457 * the <code>int</code> constants in the class
458 * <code>TCKind</code>.
459 * @return the <code>TCKind</code> instance whose <code>value</code>
460 * field matches the given <code>int</code>
461 * @exception BAD_PARAM if the given <code>int</code> does not
462 * match the <code>_value</code> field of
463 * any <code>TCKind</code> instance
464 */
465 public static TCKind from_int(int i) {
466 switch (i) {
467 case _tk_null:
468 return tk_null;
469 case _tk_void:
470 return tk_void;
471 case _tk_short:
472 return tk_short;
473 case _tk_long:
474 return tk_long;
475 case _tk_ushort:
476 return tk_ushort;
477 case _tk_ulong:
478 return tk_ulong;
479 case _tk_float:
480 return tk_float;
481 case _tk_double:
482 return tk_double;
483 case _tk_boolean:
484 return tk_boolean;
485 case _tk_char:
486 return tk_char;
487 case _tk_octet:
488 return tk_octet;
489 case _tk_any:
490 return tk_any;
491 case _tk_TypeCode:
492 return tk_TypeCode;
493 case _tk_Principal:
494 return tk_Principal;
495 case _tk_objref:
496 return tk_objref;
497 case _tk_struct:
498 return tk_struct;
499 case _tk_union:
500 return tk_union;
501 case _tk_enum:
502 return tk_enum;
503 case _tk_string:
504 return tk_string;
505 case _tk_sequence:
506 return tk_sequence;
507 case _tk_array:
508 return tk_array;
509 case _tk_alias:
510 return tk_alias;
511 case _tk_except:
512 return tk_except;
513 case _tk_longlong:
514 return tk_longlong;
515 case _tk_ulonglong:
516 return tk_ulonglong;
517 case _tk_longdouble:
518 return tk_longdouble;
519 case _tk_wchar:
520 return tk_wchar;
521 case _tk_wstring:
522 return tk_wstring;
523 case _tk_fixed:
524 return tk_fixed;
525 case _tk_value: // orbos 98-01-18: Objects By Value
526 return tk_value;
527 case _tk_value_box: // orbos 98-01-18: Objects By Value
528 return tk_value_box;
529 case _tk_native:
530 return tk_native;
531 case _tk_abstract_interface:
532 return tk_abstract_interface;
533 default:
534 throw new org.omg.CORBA.BAD_PARAM();
535 }
536 }
539 /**
540 * Creates a new <code>TCKind</code> instance initialized with the given
541 * <code>int</code>.
542 * @deprecated Do not use this constructor as this method should be private
543 * according to the OMG specification. Use {@link #from_int(int)} instead.
544 *
545 * @param _value the <code>int</code> to convert. It must be one of
546 * the <code>int</code> constants in the class
547 * <code>TCKind</code>.
548 */
549 @Deprecated
550 protected TCKind(int _value){
551 this._value = _value;
552 }
553 private int _value;
554 }