Merge from mainline.
[official-gcc.git] / libjava / classpath / org / omg / CORBA / TCKind.java
blob0ad2d528421090121b675ec0e1d5647ff16a7dd0
1 /* TCKind.java -- java to IDL mapping constants.
2 Copyright (C) 2005 Free Software Foundation, Inc.
4 This file is part of GNU Classpath.
6 GNU Classpath is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2, or (at your option)
9 any later version.
11 GNU Classpath is distributed in the hope that it will be useful, but
12 WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with GNU Classpath; see the file COPYING. If not, write to the
18 Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
19 02110-1301 USA.
21 Linking this library statically or dynamically with other modules is
22 making a combined work based on this library. Thus, the terms and
23 conditions of the GNU General Public License cover the whole
24 combination.
26 As a special exception, the copyright holders of this library give you
27 permission to link this library with independent modules to produce an
28 executable, regardless of the license terms of these independent
29 modules, and to copy and distribute the resulting executable under
30 terms of your choice, provided that you also meet, for each linked
31 independent module, the terms and conditions of the license of that
32 module. An independent module is a module which is not derived from
33 or based on this library. If you modify this library, you may extend
34 this exception to your version of the library, but you are not
35 obligated to do so. If you do not wish to do so, delete this
36 exception statement from your version. */
39 package org.omg.CORBA;
42 /**
43 * The basic constants, used in java to IDL mapping.
44 * @author Audrius Meskauskas (AudriusA@Bioinformatics.org)
46 public class TCKind
48 /**
49 * The integer constant, indicating IDL data type
50 * <code>null</code>.
52 public static final int _tk_null = 0;
54 /**
55 * The integer constant, indicating IDL data type
56 * <code>void</code>.
58 public static final int _tk_void = 1;
60 /**
61 * The integer constant, indicating IDL data type
62 * <code>short</code>.
64 public static final int _tk_short = 2;
66 /**
67 * The integer constant, indicating IDL data type
68 * <code>long</code>.
70 public static final int _tk_long = 3;
72 /**
73 * The integer constant, indicating IDL data type
74 * <code>ushort</code>.
76 public static final int _tk_ushort = 4;
78 /**
79 * The integer constant, indicating IDL data type
80 * <code>ulong</code>.
82 public static final int _tk_ulong = 5;
84 /**
85 * The integer constant, indicating IDL data type
86 * <code>float</code>.
88 public static final int _tk_float = 6;
90 /**
91 * The integer constant, indicating IDL data type
92 * <code>double</code>.
94 public static final int _tk_double = 7;
96 /**
97 * The integer constant, indicating IDL data type
98 * <code>boolean</code>.
100 public static final int _tk_boolean = 8;
103 * The integer constant, indicating IDL data type
104 * <code>char</code>.
106 public static final int _tk_char = 9;
109 * The integer constant, indicating IDL data type
110 * <code>octet</code>.
112 public static final int _tk_octet = 10;
115 * The integer constant, indicating IDL data type
116 * <code>any</code>.
118 public static final int _tk_any = 11;
121 * The integer constant, indicating IDL data type
122 * <code>TypeCode</code>.
124 public static final int _tk_TypeCode = 12;
127 * The integer constant, indicating IDL data type
128 * <code>Principal</code>.
130 public static final int _tk_Principal = 13;
133 * The integer constant, indicating IDL data type
134 * <code>objref</code>.
136 public static final int _tk_objref = 14;
139 * The integer constant, indicating IDL data type
140 * <code>struct</code>.
142 public static final int _tk_struct = 15;
145 * The integer constant, indicating IDL data type
146 * <code>union</code>.
148 public static final int _tk_union = 16;
151 * The integer constant, indicating IDL data type
152 * <code>enum</code>.
154 public static final int _tk_enum = 17;
157 * The integer constant, indicating IDL data type
158 * <code>string</code>.
160 public static final int _tk_string = 18;
163 * The integer constant, indicating IDL data type
164 * <code>sequence</code>.
166 public static final int _tk_sequence = 19;
169 * The integer constant, indicating IDL data type
170 * <code>array</code>.
172 public static final int _tk_array = 20;
175 * The integer constant, indicating IDL data type
176 * <code>alias</code>.
178 public static final int _tk_alias = 21;
181 * The integer constant, indicating IDL data type
182 * <code>except</code>.
184 public static final int _tk_except = 22;
187 * The integer constant, indicating IDL data type
188 * <code>longlong</code>.
190 public static final int _tk_longlong = 23;
193 * The integer constant, indicating IDL data type
194 * <code>ulonglong</code>.
196 public static final int _tk_ulonglong = 24;
199 * The integer constant, indicating IDL data type
200 * <code>longdouble</code>.
202 public static final int _tk_longdouble = 25;
205 * The integer constant, indicating IDL data type
206 * <code>wchar</code>.
208 public static final int _tk_wchar = 26;
211 * The integer constant, indicating IDL data type
212 * <code>wstring</code>.
214 public static final int _tk_wstring = 27;
217 * The integer constant, indicating IDL data type
218 * <code>fixed</code>.
220 public static final int _tk_fixed = 28;
223 * The integer constant, indicating IDL data type
224 * <code>value</code>.
226 public static final int _tk_value = 29;
229 * The integer constant, indicating IDL data type
230 * <code>value_box</code>.
232 public static final int _tk_value_box = 30;
235 * The integer constant, indicating IDL data type
236 * <code>native</code>.
238 public static final int _tk_native = 31;
241 * The integer constant, indicating IDL data type
242 * <code>abstract_interface</code>.
244 public static final int _tk_abstract_interface = 32;
247 * The TCKind constant, indicating IDL data type
248 * <code>null</code>
250 public static final TCKind tk_null = new TCKind(_tk_null);
253 * The TCKind constant, indicating IDL data type
254 * <code>void</code>
256 public static final TCKind tk_void = new TCKind(_tk_void);
259 * The TCKind constant, indicating IDL data type
260 * <code>short</code>
262 public static final TCKind tk_short = new TCKind(_tk_short);
265 * The TCKind constant, indicating IDL data type
266 * <code>long</code>
268 public static final TCKind tk_long = new TCKind(_tk_long);
271 * The TCKind constant, indicating IDL data type
272 * <code>ushort</code>
274 public static final TCKind tk_ushort = new TCKind(_tk_ushort);
277 * The TCKind constant, indicating IDL data type
278 * <code>ulong</code>
280 public static final TCKind tk_ulong = new TCKind(_tk_ulong);
283 * The TCKind constant, indicating IDL data type
284 * <code>float</code>
286 public static final TCKind tk_float = new TCKind(_tk_float);
289 * The TCKind constant, indicating IDL data type
290 * <code>double</code>
292 public static final TCKind tk_double = new TCKind(_tk_double);
295 * The TCKind constant, indicating IDL data type
296 * <code>boolean</code>
298 public static final TCKind tk_boolean = new TCKind(_tk_boolean);
301 * The TCKind constant, indicating IDL data type
302 * <code>char</code>
304 public static final TCKind tk_char = new TCKind(_tk_char);
307 * The TCKind constant, indicating IDL data type
308 * <code>octet</code>
310 public static final TCKind tk_octet = new TCKind(_tk_octet);
313 * The TCKind constant, indicating IDL data type
314 * <code>any</code>
316 public static final TCKind tk_any = new TCKind(_tk_any);
319 * The TCKind constant, indicating IDL data type
320 * <code>TypeCode</code>
322 public static final TCKind tk_TypeCode = new TCKind(_tk_TypeCode);
325 * The TCKind constant, indicating IDL data type
326 * <code>Principal</code>
328 public static final TCKind tk_Principal = new TCKind(_tk_Principal);
331 * The TCKind constant, indicating IDL data type
332 * <code>objref</code>
334 public static final TCKind tk_objref = new TCKind(_tk_objref);
337 * The TCKind constant, indicating IDL data type
338 * <code>struct</code>
340 public static final TCKind tk_struct = new TCKind(_tk_struct);
343 * The TCKind constant, indicating IDL data type
344 * <code>union</code>
346 public static final TCKind tk_union = new TCKind(_tk_union);
349 * The TCKind constant, indicating IDL data type
350 * <code>enum</code>
352 public static final TCKind tk_enum = new TCKind(_tk_enum);
355 * The TCKind constant, indicating IDL data type
356 * <code>string</code>
358 public static final TCKind tk_string = new TCKind(_tk_string);
361 * The TCKind constant, indicating IDL data type
362 * <code>sequence</code>
364 public static final TCKind tk_sequence = new TCKind(_tk_sequence);
367 * The TCKind constant, indicating IDL data type
368 * <code>array</code>
370 public static final TCKind tk_array = new TCKind(_tk_array);
373 * The TCKind constant, indicating IDL data type
374 * <code>alias</code>
376 public static final TCKind tk_alias = new TCKind(_tk_alias);
379 * The TCKind constant, indicating IDL data type
380 * <code>except</code>
382 public static final TCKind tk_except = new TCKind(_tk_except);
385 * The TCKind constant, indicating IDL data type
386 * <code>longlong</code>
388 public static final TCKind tk_longlong = new TCKind(_tk_longlong);
391 * The TCKind constant, indicating IDL data type
392 * <code>ulonglong</code>
394 public static final TCKind tk_ulonglong = new TCKind(_tk_ulonglong);
397 * The TCKind constant, indicating IDL data type
398 * <code>longdouble</code>
400 public static final TCKind tk_longdouble = new TCKind(_tk_longdouble);
403 * The TCKind constant, indicating IDL data type
404 * <code>wchar</code>
406 public static final TCKind tk_wchar = new TCKind(_tk_wchar);
409 * The TCKind constant, indicating IDL data type
410 * <code>wstring</code>
412 public static final TCKind tk_wstring = new TCKind(_tk_wstring);
415 * The TCKind constant, indicating IDL data type
416 * <code>fixed</code>
418 public static final TCKind tk_fixed = new TCKind(_tk_fixed);
421 * The TCKind constant, indicating IDL data type
422 * <code>value</code>
424 public static final TCKind tk_value = new TCKind(_tk_value);
427 * The TCKind constant, indicating IDL data type
428 * <code>value_box</code>
430 public static final TCKind tk_value_box = new TCKind(_tk_value_box);
433 * The TCKind constant, indicating IDL data type
434 * <code>native</code>
436 public static final TCKind tk_native = new TCKind(_tk_native);
439 * The TCKind constant, indicating IDL data type
440 * <code>abstract_interface</code>
442 public static final TCKind tk_abstract_interface =
443 new TCKind(_tk_abstract_interface);
446 * The kind value for this instance.
448 private final int _value;
451 * The array of all tk_... instances, sorted by the kind number.
453 * As long as the kind numbers make the continuos sequence, starting from 0,
454 * the members can be found just by direct indexing.
456 private static final TCKind[] tk =
457 new TCKind[]
459 tk_null, tk_void, tk_short, tk_long, tk_ushort, tk_ulong, tk_float,
460 tk_double, tk_boolean, tk_char, tk_octet, tk_any, tk_TypeCode,
461 tk_Principal, tk_objref, tk_struct, tk_union, tk_enum, tk_string,
462 tk_sequence, tk_array, tk_alias, tk_except, tk_longlong, tk_ulonglong,
463 tk_longdouble, tk_wchar, tk_wstring, tk_fixed, tk_value, tk_value_box,
464 tk_native, tk_abstract_interface
468 * Creates a new TCKind instance with the given integer constant value.
469 * @deprecated it is recommended to use {@link #from_int(int)} that
470 * reuses existing TCKind object instead of allocating the new instance.
471 * @param kind one of the <code>_tk_..</code> constants.
473 protected TCKind(int kind)
475 _value = kind;
479 * Returns the integer value, corresponding this instance of TCKind.
480 * @return the <code>_tk_..</code> value, matching this instance.
482 public int value()
484 return _value;
488 * Return a TCKind object, matching the given integer code.
489 * @param _tk_nnn the TCKind code, one of <code>_tk_..</code> constants.
490 * @return the matching instance of TCKind, on of tk_.. constants.
491 * @throws BAD_PARAM if the given integer constant is not one of the
492 * valid <code>_tk_..</code> constants.
494 public static TCKind from_int(int _tk_nnn)
496 try {
497 return tk[_tk_nnn];
499 catch (ArrayIndexOutOfBoundsException aex) {
500 throw new BAD_PARAM("Invalid _tk_ code "+_tk_nnn);