1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/src/share/classes/org/omg/CORBA/TCKind.java Sat Dec 01 00:00:00 2007 +0000 1.3 @@ -0,0 +1,556 @@ 1.4 +/* 1.5 + * Copyright 1997-2004 Sun Microsystems, Inc. All Rights Reserved. 1.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 1.7 + * 1.8 + * This code is free software; you can redistribute it and/or modify it 1.9 + * under the terms of the GNU General Public License version 2 only, as 1.10 + * published by the Free Software Foundation. Sun designates this 1.11 + * particular file as subject to the "Classpath" exception as provided 1.12 + * by Sun in the LICENSE file that accompanied this code. 1.13 + * 1.14 + * This code is distributed in the hope that it will be useful, but WITHOUT 1.15 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 1.16 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 1.17 + * version 2 for more details (a copy is included in the LICENSE file that 1.18 + * accompanied this code). 1.19 + * 1.20 + * You should have received a copy of the GNU General Public License version 1.21 + * 2 along with this work; if not, write to the Free Software Foundation, 1.22 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 1.23 + * 1.24 + * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, 1.25 + * CA 95054 USA or visit www.sun.com if you need additional information or 1.26 + * have any questions. 1.27 + */ 1.28 + 1.29 +package org.omg.CORBA; 1.30 + 1.31 + 1.32 +/** 1.33 + * The Java mapping of the IDL enum <code>TCKind</code>, which 1.34 + * specifies the kind of a <code>TypeCode</code> object. There is 1.35 + * one kind for each primitive and essential IDL data type. 1.36 + * <P> 1.37 + * The class <code>TCKind</code> consists of: 1.38 + * <UL> 1.39 + * <LI>a set of <code>int</code> constants, one for each 1.40 + * kind of IDL data type. These <code>int</code> constants 1.41 + * make it possible to use a <code>switch</code> statement. 1.42 + * <LI>a set of <code>TCKind</code> constants, one for each 1.43 + * kind of IDL data type. The <code>value</code> field for 1.44 + * each <code>TCKind</code> instance is initialized with 1.45 + * the <code>int</code> constant that corresponds with 1.46 + * the IDL data type that the instance represents. 1.47 + * <LI>the method <code>from_int</code>for converting 1.48 + * an <code>int</code> to its 1.49 + * corresponding <code>TCKind</code> instance 1.50 + * <P>Example: 1.51 + * <PRE> 1.52 + * org.omg.CORBA.TCKind k = org.omg.CORBA.TCKind.from_int( 1.53 + * org.omg.CORBA.TCKind._tk_string); 1.54 + * </PRE> 1.55 + * The variable <code>k</code> represents the <code>TCKind</code> 1.56 + * instance for the IDL type <code>string</code>, which is 1.57 + * <code>tk_string</code>. 1.58 + * <P> 1.59 + * <LI>the method <code>value</code> for accessing the 1.60 + * <code>_value</code> field of a <code>TCKind</code> constant 1.61 + * <P>Example: 1.62 + * <PRE> 1.63 + * int i = org.omg.CORBA.TCKind.tk_char.value(); 1.64 + * </PRE> 1.65 + * The variable <code>i</code> represents 9, the value for the 1.66 + * IDL data type <code>char</code>. 1.67 + * </UL> 1.68 + * <P>The <code>value</code> field of a <code>TCKind</code> instance 1.69 + * is the CDR encoding used for a <code>TypeCode</code> object in 1.70 + * an IIOP message. 1.71 + */ 1.72 + 1.73 +public class TCKind { 1.74 + 1.75 + /** 1.76 + * The <code>int</code> constant for a <code>null</code> IDL data type. 1.77 + */ 1.78 + public static final int _tk_null = 0; 1.79 + 1.80 + /** 1.81 + * The <code>int</code> constant for the IDL data type <code>void</code>. 1.82 + */ 1.83 + public static final int _tk_void = 1; 1.84 + 1.85 + /** 1.86 + * The <code>int</code> constant for the IDL data type <code>short</code>. 1.87 + */ 1.88 + public static final int _tk_short = 2; 1.89 + 1.90 + /** 1.91 + * The <code>int</code> constant for the IDL data type <code>long</code>. 1.92 + */ 1.93 + public static final int _tk_long = 3; 1.94 + 1.95 + /** 1.96 + * The <code>int</code> constant for the IDL data type <code>ushort</code>. 1.97 + */ 1.98 + public static final int _tk_ushort = 4; 1.99 + 1.100 + /** 1.101 + * The <code>int</code> constant for the IDL data type <code>ulong</code>. 1.102 + */ 1.103 + public static final int _tk_ulong = 5; 1.104 + 1.105 + /** 1.106 + * The <code>int</code> constant for the IDL data type <code>float</code>. 1.107 + */ 1.108 + public static final int _tk_float = 6; 1.109 + 1.110 + /** 1.111 + * The <code>int</code> constant for the IDL data type <code>double</code>. 1.112 + */ 1.113 + public static final int _tk_double = 7; 1.114 + 1.115 + /** 1.116 + * The <code>int</code> constant for the IDL data type <code>boolean</code>. 1.117 + */ 1.118 + public static final int _tk_boolean = 8; 1.119 + 1.120 + /** 1.121 + * The <code>int</code> constant for the IDL data type <code>char</code>. 1.122 + */ 1.123 + public static final int _tk_char = 9; 1.124 + 1.125 + /** 1.126 + * The <code>int</code> constant for the IDL data type <code>octet</code>. 1.127 + */ 1.128 + public static final int _tk_octet = 10; 1.129 + 1.130 + /** 1.131 + * The <code>int</code> constant for the IDL data type <code>any</code>. 1.132 + */ 1.133 + public static final int _tk_any = 11; 1.134 + 1.135 + /** 1.136 + * The <code>int</code> constant for the IDL data type <code>TypeCode</code>. 1.137 + */ 1.138 + public static final int _tk_TypeCode = 12; 1.139 + 1.140 + /** 1.141 + * The <code>int</code> constant for the IDL data type <code>Principal</code>. 1.142 + */ 1.143 + public static final int _tk_Principal = 13; 1.144 + 1.145 + /** 1.146 + * The <code>int</code> constant for the IDL data type <code>objref</code>. 1.147 + */ 1.148 + public static final int _tk_objref = 14; 1.149 + 1.150 + /** 1.151 + * The <code>int</code> constant for the IDL data type <code>struct</code>. 1.152 + */ 1.153 + public static final int _tk_struct = 15; 1.154 + 1.155 + /** 1.156 + * The <code>int</code> constant for the IDL data type <code>union</code>. 1.157 + */ 1.158 + public static final int _tk_union = 16; 1.159 + 1.160 + /** 1.161 + * The <code>int</code> constant for the IDL data type <code>enum</code>. 1.162 + */ 1.163 + public static final int _tk_enum = 17; 1.164 + 1.165 + /** 1.166 + * The <code>int</code> constant for the IDL data type <code>string</code>. 1.167 + */ 1.168 + public static final int _tk_string = 18; 1.169 + 1.170 + /** 1.171 + * The <code>int</code> constant for the IDL data type <code>sequence</code>. 1.172 + */ 1.173 + public static final int _tk_sequence = 19; 1.174 + 1.175 + /** 1.176 + * The <code>int</code> constant for the IDL data type <code>array</code>. 1.177 + */ 1.178 + public static final int _tk_array = 20; 1.179 + 1.180 + /** 1.181 + * The <code>int</code> constant for the IDL data type <code>alias</code>. 1.182 + */ 1.183 + public static final int _tk_alias = 21; 1.184 + 1.185 + /** 1.186 + * The <code>int</code> constant for the IDL data type <code>except</code>. 1.187 + */ 1.188 + public static final int _tk_except = 22; 1.189 + 1.190 + /** 1.191 + * The <code>int</code> constant for the IDL data type <code>longlong</code>. 1.192 + */ 1.193 + public static final int _tk_longlong = 23; 1.194 + 1.195 + /** 1.196 + * The <code>int</code> constant for the IDL data type <code>ulonglong</code>. 1.197 + */ 1.198 + public static final int _tk_ulonglong = 24; 1.199 + 1.200 + /** 1.201 + * The <code>int</code> constant for the IDL data type <code>longdouble</code>. 1.202 + */ 1.203 + public static final int _tk_longdouble = 25; 1.204 + 1.205 + /** 1.206 + * The <code>int</code> constant for the IDL data type <code>wchar</code>. 1.207 + */ 1.208 + public static final int _tk_wchar = 26; 1.209 + 1.210 + /** 1.211 + * The <code>int</code> constant for the IDL data type <code>wstring</code>. 1.212 + */ 1.213 + public static final int _tk_wstring = 27; 1.214 + 1.215 + /** 1.216 + * The <code>int</code> constant for the IDL data type <code>fixed</code>. 1.217 + */ 1.218 + public static final int _tk_fixed = 28; 1.219 + 1.220 + /** 1.221 + * The <code>int</code> constant for the IDL data type <code>value</code>. 1.222 + */ 1.223 + public static final int _tk_value = 29; // orbos 98-01-18: Objects By Value 1.224 + 1.225 + /** 1.226 + * The <code>int</code> constant for the IDL data type <code>value_box</code>. 1.227 + */ 1.228 + public static final int _tk_value_box = 30; // orbos 98-01-18: Objects By Value 1.229 + 1.230 + /** 1.231 + * The <code>int</code> constant for the IDL data type <code>native</code>. 1.232 + */ 1.233 + public static final int _tk_native = 31; // Verify 1.234 + 1.235 + /** 1.236 + * The <code>int</code> constant for the IDL data type <code>abstract interface</code>. 1.237 + */ 1.238 + public static final int _tk_abstract_interface = 32; 1.239 + 1.240 + 1.241 + /** 1.242 + * The <code>TCKind</code> constant whose <code>value</code> field is 1.243 + * initialized with <code>TCKind._tk_null</code>. 1.244 + */ 1.245 + public static final TCKind tk_null = new TCKind(_tk_null); 1.246 + 1.247 + /** 1.248 + * The <code>TCKind</code> constant whose <code>value</code> field is 1.249 + * initialized with <code>TCKind._tk_void</code>. 1.250 + */ 1.251 + public static final TCKind tk_void = new TCKind(_tk_void); 1.252 + 1.253 + /** 1.254 + * The <code>TCKind</code> constant whose <code>value</code> field is 1.255 + * initialized with <code>TCKind._tk_short</code>. 1.256 + */ 1.257 + public static final TCKind tk_short = new TCKind(_tk_short); 1.258 + 1.259 + /** 1.260 + * The <code>TCKind</code> constant whose <code>value</code> field is 1.261 + * initialized with <code>TCKind._tk_long</code>. 1.262 + */ 1.263 + public static final TCKind tk_long = new TCKind(_tk_long); 1.264 + 1.265 + /** 1.266 + * The <code>TCKind</code> constant whose <code>value</code> field is 1.267 + * initialized with <code>TCKind._tk_ushort</code>. 1.268 + */ 1.269 + public static final TCKind tk_ushort = new TCKind(_tk_ushort); 1.270 + 1.271 + /** 1.272 + * The <code>TCKind</code> constant whose <code>value</code> field is 1.273 + * initialized with <code>TCKind._tk_ulong</code>. 1.274 + */ 1.275 + public static final TCKind tk_ulong = new TCKind(_tk_ulong); 1.276 + 1.277 + /** 1.278 + * The <code>TCKind</code> constant whose <code>value</code> field is 1.279 + * initialized with <code>TCKind._tk_float</code>. 1.280 + */ 1.281 + public static final TCKind tk_float = new TCKind(_tk_float); 1.282 + 1.283 + /** 1.284 + * The <code>TCKind</code> constant whose <code>value</code> field is 1.285 + * initialized with <code>TCKind._tk_double</code>. 1.286 + */ 1.287 + public static final TCKind tk_double = new TCKind(_tk_double); 1.288 + 1.289 + /** 1.290 + * The <code>TCKind</code> constant whose <code>value</code> field is 1.291 + * initialized with <code>TCKind._tk_boolean</code>. 1.292 + */ 1.293 + public static final TCKind tk_boolean = new TCKind(_tk_boolean); 1.294 + 1.295 + /** 1.296 + * The <code>TCKind</code> constant whose <code>value</code> field is 1.297 + * initialized with <code>TCKind._tk_char</code>. 1.298 + */ 1.299 + public static final TCKind tk_char = new TCKind(_tk_char); 1.300 + 1.301 + /** 1.302 + * The <code>TCKind</code> constant whose <code>value</code> field is 1.303 + * initialized with <code>TCKind._tk_octet</code>. 1.304 + */ 1.305 + public static final TCKind tk_octet = new TCKind(_tk_octet); 1.306 + 1.307 + /** 1.308 + * The <code>TCKind</code> constant whose <code>value</code> field is 1.309 + * initialized with <code>TCKind._tk_any</code>. 1.310 + */ 1.311 + public static final TCKind tk_any = new TCKind(_tk_any); 1.312 + 1.313 + /** 1.314 + * The <code>TCKind</code> constant whose <code>value</code> field is 1.315 + * initialized with <code>TCKind._tk_TypeCode</code>. 1.316 + */ 1.317 + public static final TCKind tk_TypeCode = new TCKind(_tk_TypeCode); 1.318 + 1.319 + /** 1.320 + * The <code>TCKind</code> constant whose <code>value</code> field is 1.321 + * initialized with <code>TCKind._tk_Principal</code>. 1.322 + */ 1.323 + public static final TCKind tk_Principal = new TCKind(_tk_Principal); 1.324 + 1.325 + /** 1.326 + * The <code>TCKind</code> constant whose <code>value</code> field is 1.327 + * initialized with <code>TCKind._tk_objref</code>. 1.328 + */ 1.329 + public static final TCKind tk_objref = new TCKind(_tk_objref); 1.330 + 1.331 + /** 1.332 + * The <code>TCKind</code> constant whose <code>value</code> field is 1.333 + * initialized with <code>TCKind._tk_struct</code>. 1.334 + */ 1.335 + public static final TCKind tk_struct = new TCKind(_tk_struct); 1.336 + 1.337 + /** 1.338 + * The <code>TCKind</code> constant whose <code>value</code> field is 1.339 + * initialized with <code>TCKind._tk_union</code>. 1.340 + */ 1.341 + public static final TCKind tk_union = new TCKind(_tk_union); 1.342 + 1.343 + /** 1.344 + * The <code>TCKind</code> constant whose <code>value</code> field is 1.345 + * initialized with <code>TCKind._tk_enum</code>. 1.346 + */ 1.347 + public static final TCKind tk_enum = new TCKind(_tk_enum); 1.348 + 1.349 + /** 1.350 + * The <code>TCKind</code> constant whose <code>value</code> field is 1.351 + * initialized with <code>TCKind._tk_string</code>. 1.352 + */ 1.353 + public static final TCKind tk_string = new TCKind(_tk_string); 1.354 + 1.355 + /** 1.356 + * The <code>TCKind</code> constant whose <code>value</code> field is 1.357 + * initialized with <code>TCKind._tk_sequence</code>. 1.358 + */ 1.359 + public static final TCKind tk_sequence = new TCKind(_tk_sequence); 1.360 + 1.361 + /** 1.362 + * The <code>TCKind</code> constant whose <code>value</code> field is 1.363 + * initialized with <code>TCKind._tk_array</code>. 1.364 + */ 1.365 + public static final TCKind tk_array = new TCKind(_tk_array); 1.366 + 1.367 + /** 1.368 + * The <code>TCKind</code> constant whose <code>value</code> field is 1.369 + * initialized with <code>TCKind._tk_alias</code>. 1.370 + */ 1.371 + public static final TCKind tk_alias = new TCKind(_tk_alias); 1.372 + 1.373 + /** 1.374 + * The <code>TCKind</code> constant whose <code>value</code> field is 1.375 + * initialized with <code>TCKind._tk_except</code>. 1.376 + */ 1.377 + public static final TCKind tk_except = new TCKind(_tk_except); 1.378 + 1.379 + /** 1.380 + * The <code>TCKind</code> constant whose <code>value</code> field is 1.381 + * initialized with <code>TCKind._tk_longlong</code>. 1.382 + */ 1.383 + public static final TCKind tk_longlong = new TCKind(_tk_longlong); 1.384 + 1.385 + /** 1.386 + * The <code>TCKind</code> constant whose <code>value</code> field is 1.387 + * initialized with <code>TCKind._tk_ulonglong</code>. 1.388 + */ 1.389 + public static final TCKind tk_ulonglong = new TCKind(_tk_ulonglong); 1.390 + 1.391 + /** 1.392 + * The <code>TCKind</code> constant whose <code>value</code> field is 1.393 + * initialized with <code>TCKind._tk_longdouble</code>. 1.394 + */ 1.395 + public static final TCKind tk_longdouble = new TCKind(_tk_longdouble); 1.396 + 1.397 + /** 1.398 + * The <code>TCKind</code> constant whose <code>value</code> field is 1.399 + * initialized with <code>TCKind._tk_wchar</code>. 1.400 + */ 1.401 + public static final TCKind tk_wchar = new TCKind(_tk_wchar); 1.402 + 1.403 + /** 1.404 + * The <code>TCKind</code> constant whose <code>value</code> field is 1.405 + * initialized with <code>TCKind._tk_wstring</code>. 1.406 + */ 1.407 + public static final TCKind tk_wstring = new TCKind(_tk_wstring); 1.408 + 1.409 + /** 1.410 + * The <code>TCKind</code> constant whose <code>value</code> field is 1.411 + * initialized with <code>TCKind._tk_fixed</code>. 1.412 + */ 1.413 + public static final TCKind tk_fixed = new TCKind(_tk_fixed); 1.414 + 1.415 + // orbos 98-01-18: Objects By Value -- begin 1.416 + 1.417 + /** 1.418 + * The <code>TCKind</code> constant whose <code>value</code> field is 1.419 + * initialized with <code>TCKind._tk_value</code>. 1.420 + */ 1.421 + public static final TCKind tk_value = new TCKind(_tk_value); 1.422 + 1.423 + /** 1.424 + * The <code>TCKind</code> constant whose <code>value</code> field is 1.425 + * initialized with <code>TCKind._tk_value_box</code>. 1.426 + */ 1.427 + public static final TCKind tk_value_box = new TCKind(_tk_value_box); 1.428 + // orbos 98-01-18: Objects By Value -- end 1.429 + 1.430 + /** 1.431 + * The <code>TCKind</code> constant whose <code>value</code> field is 1.432 + * initialized with <code>TCKind._tk_native</code>. 1.433 + */ 1.434 + public static final TCKind tk_native = new TCKind(_tk_native); 1.435 + 1.436 + /** 1.437 + * The <code>TCKind</code> constant whose <code>value</code> field is 1.438 + * initialized with <code>TCKind._tk_abstract_interface</code>. 1.439 + */ 1.440 + public static final TCKind tk_abstract_interface = new TCKind(_tk_abstract_interface); 1.441 + 1.442 + 1.443 + 1.444 + 1.445 + /** 1.446 + * Retrieves the value of this <code>TCKind</code> instance. 1.447 + * 1.448 + * @return the <code>int</code> that represents the kind of 1.449 + * IDL data type for this <code>TCKind</code> instance 1.450 + */ 1.451 + public int value() { 1.452 + return _value; 1.453 + } 1.454 + 1.455 + /** 1.456 + * Converts the given <code>int</code> to the corresponding 1.457 + * <code>TCKind</code> instance. 1.458 + * 1.459 + * @param i the <code>int</code> to convert. It must be one of 1.460 + * the <code>int</code> constants in the class 1.461 + * <code>TCKind</code>. 1.462 + * @return the <code>TCKind</code> instance whose <code>value</code> 1.463 + * field matches the given <code>int</code> 1.464 + * @exception BAD_PARAM if the given <code>int</code> does not 1.465 + * match the <code>_value</code> field of 1.466 + * any <code>TCKind</code> instance 1.467 + */ 1.468 + public static TCKind from_int(int i) { 1.469 + switch (i) { 1.470 + case _tk_null: 1.471 + return tk_null; 1.472 + case _tk_void: 1.473 + return tk_void; 1.474 + case _tk_short: 1.475 + return tk_short; 1.476 + case _tk_long: 1.477 + return tk_long; 1.478 + case _tk_ushort: 1.479 + return tk_ushort; 1.480 + case _tk_ulong: 1.481 + return tk_ulong; 1.482 + case _tk_float: 1.483 + return tk_float; 1.484 + case _tk_double: 1.485 + return tk_double; 1.486 + case _tk_boolean: 1.487 + return tk_boolean; 1.488 + case _tk_char: 1.489 + return tk_char; 1.490 + case _tk_octet: 1.491 + return tk_octet; 1.492 + case _tk_any: 1.493 + return tk_any; 1.494 + case _tk_TypeCode: 1.495 + return tk_TypeCode; 1.496 + case _tk_Principal: 1.497 + return tk_Principal; 1.498 + case _tk_objref: 1.499 + return tk_objref; 1.500 + case _tk_struct: 1.501 + return tk_struct; 1.502 + case _tk_union: 1.503 + return tk_union; 1.504 + case _tk_enum: 1.505 + return tk_enum; 1.506 + case _tk_string: 1.507 + return tk_string; 1.508 + case _tk_sequence: 1.509 + return tk_sequence; 1.510 + case _tk_array: 1.511 + return tk_array; 1.512 + case _tk_alias: 1.513 + return tk_alias; 1.514 + case _tk_except: 1.515 + return tk_except; 1.516 + case _tk_longlong: 1.517 + return tk_longlong; 1.518 + case _tk_ulonglong: 1.519 + return tk_ulonglong; 1.520 + case _tk_longdouble: 1.521 + return tk_longdouble; 1.522 + case _tk_wchar: 1.523 + return tk_wchar; 1.524 + case _tk_wstring: 1.525 + return tk_wstring; 1.526 + case _tk_fixed: 1.527 + return tk_fixed; 1.528 + case _tk_value: // orbos 98-01-18: Objects By Value 1.529 + return tk_value; 1.530 + case _tk_value_box: // orbos 98-01-18: Objects By Value 1.531 + return tk_value_box; 1.532 + case _tk_native: 1.533 + return tk_native; 1.534 + case _tk_abstract_interface: 1.535 + return tk_abstract_interface; 1.536 + default: 1.537 + throw new org.omg.CORBA.BAD_PARAM(); 1.538 + } 1.539 + } 1.540 + 1.541 + 1.542 + /** 1.543 + * Creates a new <code>TCKind</code> instance initialized with the given 1.544 + * <code>int</code>. 1.545 + * @deprecated Do not use this constructor as this method should be private 1.546 + * according to the OMG specification. Use {@link #from_int(int)} instead. 1.547 + * 1.548 + * @param _value the <code>int</code> to convert. It must be one of 1.549 + * the <code>int</code> constants in the class 1.550 + * <code>TCKind</code>. 1.551 + * @return a new <code>TCKind</code> instance whose <code>value</code> 1.552 + * field matches the given <code>int</code> 1.553 + */ 1.554 + @Deprecated 1.555 + protected TCKind(int _value){ 1.556 + this._value = _value; 1.557 + } 1.558 + private int _value; 1.559 +}