1 /* 2 * Copyright (c) 1996, 2003, 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 */ 25 26 package org.omg.CORBA; 27 28 import org.omg.CORBA.TypeCodePackage.*; 29 import org.omg.CORBA.portable.IDLEntity; 30 31 /** 32 * A container for information about a specific CORBA data 33 * type. 34 *<P> 35 * <code>TypeCode</code> objects are used: 36 * <UL> 37 * <LI>in the Dynamic Invocation Interface -- to indicate the types 38 * of the actual arguments or the type of the return value. <BR> 39 * <code>NamedValue</code> objects are used to represent arguments and 40 * return values. One of their components is an <code>Any</code> 41 * object, which in turn has as one of its components a 42 * <code>TypeCode</code> object. 43 * <LI>by an Interface Repository to represent the type specifications 44 * that are part of many OMG IDL declarations 45 * </UL> 46 * <P> 47 * The representation of a <code>TypeCode</code> object is opaque, 48 * but abstractly, a <code>TypeCode</code> object consists of: 49 * <UL> 50 * <LI>a <code>kind</code> field, which is set to an instance 51 * of the class <code>TCKind</code> 52 * <LI>zero or more additional fields appropriate 53 * for the particular kind. For example, the 54 * <code>TypeCode</code> object 55 * describing the OMG IDL type <code>1ong</code> has kind 56 * <code>TCKind.tk_long</code> and no additional fields. 57 * The <code>TypeCode</code> describing OMG IDL type 58 * <code>sequence<boolean, 10></code> has a <code>kind</code> field 59 * with the value 60 * <code>TCKind.tk_sequence</code> and also fields with the values 61 * <code>boolean</code> and <code>10</code> for the 62 * type of sequence elements and the length of the sequence. <p> 63 * </UL> 64 * 65 * <code>TypeCode</code> objects can be obtained in various ways: 66 * <OL> 67 * <LI>from a call to the method <code>Any.insert_X</code>, where X is 68 * a basic IDL type. This method creates a <code>TypeCode</code> object 69 * for type X and assigns it to the <code>Any</code> object's 70 * <code>type</code> field. 71 * <LI>from invocations of methods in the ORB class 72 * <P>For example, the following creates a <code>TypeCode</code> 73 * object for a <code>string</code> with a maximum of 30 characters: 74 * <PRE> 75 * org.omg.CORBA.TypeCode tcString = orb.create_string_tc(30); 76 * </PRE> 77 * <P> The following creates a <code>TypeCode</code> 78 * object for an <code>array</code> of five <code>string</code>s: 79 * <PRE> 80 * org.omg.CORBA.TypeCode tcArray = orb.create_array_tc( 81 * 5, TCKind.tk_string); 82 * </PRE> 147 * <P> 148 * These methods may be invoked on <code>string</code>, 149 * <code>sequence</code>, and <code>array</code>: 150 * <UL> 151 * <LI><code>length</code> 152 * </UL> 153 * <P> 154 * These methods may be invoked on <code>alias</code>, 155 * <code>sequence</code>, <code>array</code>, and <code>value_box</code>: 156 * <UL> 157 * <LI><code>content_type</code> 158 * </UL> 159 * <P> 160 * Unlike other CORBA pseudo-objects, <code>TypeCode</code> 161 * objects can be passed as general IDL parameters. <p> 162 * The methods <code>parameter</code> and <code>param_count</code>, 163 * which are deprecated, are not mapped. <p> 164 * 165 * Java IDL extends the CORBA specification to allow all operations permitted 166 * on a <code>struct</code> <code>TypeCode</code> to be permitted 167 * on an <code>exception</code> <code>TypeCode</code> as well. <p> 168 * 169 */ 170 public abstract class TypeCode implements IDLEntity { 171 172 /** 173 * Compares this <code>TypeCode</code> object with the given one, 174 * testing for equality. <code>TypeCode</code> objects are equal if 175 * they are interchangeable and give identical results when 176 * <code>TypeCode</code> operations are applied to them. 177 * 178 * @param tc the <code>TypeCode</code> object to compare against 179 * @return <code>true</code> if the type codes are equal; 180 * <code>false</code> otherwise 181 */ 182 183 public abstract boolean equal(TypeCode tc); 184 185 /** 186 * Tests to see if the given <code>TypeCode</code> object is 187 * equivalent to this <code>TypeCode</code> object. 188 * <P> 189 * 190 * 191 * @param tc the typecode to compare with this typecode 192 * 193 * @return <code>true</code> if the given typecode is equivalent to 194 * this typecode; <code>false</code> otherwise 195 * 196 */ 197 public abstract boolean equivalent(TypeCode tc); 198 199 /** 200 * Strips out all optional name and member name fields, 201 * but leaves all alias typecodes intact. 202 * @return a <code>TypeCode</code> object with optional name and 203 * member name fields stripped out, except for alias typecodes, 204 * which are left intact 205 * @see <a href="package-summary.html#unimpl"><code>CORBA</code> package 206 * comments for unimplemented features</a> 207 */ 208 public abstract TypeCode get_compact_typecode(); 209 210 211 /** 212 * Retrieves the kind of this <code>TypeCode</code> object. 213 * The kind of a type code determines which <code>TypeCode</code> 214 * methods may legally be invoked on it. 215 * <P> 216 * The method <code>kind</code> may be invoked on any 217 * <code>TypeCode</code> object. 218 * 219 * @return the <code>TCKind</code> instance indicating the 220 * value of the <code>kind</code> field of this 221 * <code>TypeCode</code> object 222 */ 223 224 public abstract TCKind kind(); 225 226 /** 227 * Retrieves the RepositoryId globally identifying the type 228 * of this <code>TypeCode</code> object. 229 * <P> 230 * The method <code>id</code> can be invoked on object reference, 231 * structure, union, enumeration, alias, exception, valuetype, 232 * boxed valuetype, native, and abstract interface type codes. 233 * Object reference, exception, valuetype, boxed valuetype, 234 * native, and abstract interface <code>TypeCode</code> objects 235 * always have a RepositoryId. 236 * Structure, union, enumeration, and alias <code>TypeCode</code> objects 237 * obtained from the Interface Repository or the method 238 * <code>ORB.create_operation_list</code> 239 * also always have a RepositoryId. If there is no RepositoryId, the 240 * method can return an empty string. 241 * 242 * @return the RepositoryId for this <code>TypeCode</code> object 243 * or an empty string if there is no RepositoryID 244 * @throws org.omg.CORBA.TypeCodePackage.BadKind if the method 245 * is invoked on an inappropriate kind of<code>TypeCode</code> 246 * object 247 */ 248 249 public abstract String id() throws BadKind; 250 251 /** 252 * Retrieves the simple name identifying this <code>TypeCode</code> 253 * object within its 254 * enclosing scope. Since names are local to a Repository, the 255 * name returned from a <code>TypeCode</code> object 256 * may not match the name of the 257 * type in any particular Repository, and may even be an empty 258 * string. 259 * <P> 260 * The method <code>name</code> can be invoked on object reference, 261 * structure, union, enumeration, alias, exception, valuetype, 262 * boxed valuetype, native, and abstract interface 263 * <code>TypeCode</code> objects. 264 * 265 * @return the name identifying this <code>TypeCode</code> object 266 * or an empty string 267 * @throws org.omg.CORBA.TypeCodePackage.BadKind if the method 268 * is invoked on an inappropriate kind of<code>TypeCode</code> 269 * object 270 */ 271 272 public abstract String name() throws BadKind; 273 274 /** 275 * Retrieves the number of members in the type described by 276 * this <code>TypeCode</code> object. 277 * <P> 278 * The method <code>member_count</code> can be invoked on 279 * structure, union, and enumeration <code>TypeCode</code> objects. 280 * Java IDL extends the CORBA specification to allow this method to 281 * operate on exceptions as well. 282 * 283 * @return the number of members constituting the type described 284 * by this <code>TypeCode</code> object 285 * 286 * @throws org.omg.CORBA.TypeCodePackage.BadKind if the method 287 * is invoked on an inappropriate kind of <code>TypeCode</code> 288 * object 289 */ 290 291 public abstract int member_count() throws BadKind; 292 293 /** 294 * Retrieves the simple name of the member identified by 295 * the given index. Since names are local to a 296 * Repository, the name returned from a <code>TypeCode</code> object 297 * may not match the name of the member in any particular 298 * Repository, and may even be an empty string. 299 * <P> 300 * The method <code>member_name</code> can be invoked on structure, union, 301 * and enumeration <code>TypeCode</code> objects. 302 * Java IDL extends the CORBA specification to allow this method to 303 * operate on exceptions as well. 304 * 305 * @param index index of the member for which a name is being reqested 306 * @return simple name of the member identified by the 307 * index or an empty string 308 * @throws org.omg.CORBA.TypeCodePackage.Bounds if the index is equal 309 * to or greater than 310 * the number of members constituting the type 311 * @throws org.omg.CORBA.TypeCodePackage.BadKind if the method 312 * is invoked on an inappropriate kind of <code>TypeCode</code> 313 * object 314 */ 315 316 public abstract String member_name(int index) 317 throws BadKind, org.omg.CORBA.TypeCodePackage.Bounds; 318 319 /** 320 * Retrieves the <code>TypeCode</code> object describing the type 321 * of the member identified by the given index. 322 * <P> 323 * The method <code>member_type</code> can be invoked on structure 324 * and union <code>TypeCode</code> objects. 325 * Java IDL extends the CORBA specification to allow this method to 326 * operate on exceptions as well. 327 * 328 * @param index index of the member for which type information 329 * is begin requested 330 * @return the <code>TypeCode</code> object describing the 331 * member at the given index 332 * @throws org.omg.CORBA.TypeCodePackage.Bounds if the index is 333 * equal to or greater than 334 * the number of members constituting the type 335 * @throws org.omg.CORBA.TypeCodePackage.BadKind if the method 336 * is invoked on an inappropriate kind of <code>TypeCode</code> 337 * object 338 */ 339 340 public abstract TypeCode member_type(int index) 341 throws BadKind, org.omg.CORBA.TypeCodePackage.Bounds; 342 343 /** 344 * Retrieves the label of the union member 345 * identified by the given index. For the default member, 346 * the label is the zero octet. 347 *<P> 348 * The method <code>member_label</code> can only be invoked on union 349 * <code>TypeCode</code> objects. 350 * 351 * @param index index of the union member for which the 352 * label is being requested 353 * @return an <code>Any</code> object describing the label of 354 * the requested union member or the zero octet for 355 * the default member 356 * @throws org.omg.CORBA.TypeCodePackage.Bounds if the index is 357 * equal to or greater than 358 * the number of members constituting the union 359 * @throws org.omg.CORBA.TypeCodePackage.BadKind if the method 360 * is invoked on a non-union <code>TypeCode</code> 361 * object 362 */ 363 364 public abstract Any member_label(int index) 365 throws BadKind, org.omg.CORBA.TypeCodePackage.Bounds; 366 367 /** 368 * Returns a <code>TypeCode</code> object describing 369 * all non-default member labels. 370 * The method <code>discriminator_type</code> can be invoked only 371 * on union <code>TypeCode</code> objects. 372 * 373 * @return the <code>TypeCode</code> object describing 374 * the non-default member labels 375 * @throws org.omg.CORBA.TypeCodePackage.BadKind if the method 376 * is invoked on a non-union <code>TypeCode</code> 377 * object 378 */ 379 380 public abstract TypeCode discriminator_type() 381 throws BadKind; 382 383 /** 384 * Returns the index of the 385 * default member, or -1 if there is no default member. 386 * <P> 387 * The method <code>default_index</code> can be invoked only on union 388 * <code>TypeCode</code> objects. 389 * 390 * @return the index of the default member, or -1 if 391 * there is no default member 392 * @throws org.omg.CORBA.TypeCodePackage.BadKind if the method 393 * is invoked on a non-union <code>TypeCode</code> 394 * object 395 */ 396 397 public abstract int default_index() throws BadKind; 398 399 /** 400 * Returns the number of elements in the type described by 401 * this <code>TypeCode</code> object. 402 * For strings and sequences, it returns the 403 * bound, with zero indicating an unbounded string or sequence. 404 * For arrays, it returns the number of elements in the array. 405 * <P> 406 * The method <code>length</code> can be invoked on string, sequence, and 407 * array <code>TypeCode</code> objects. 408 * 409 * @return the bound for strings and sequences, or the 410 * number of elements for arrays 411 * @throws org.omg.CORBA.TypeCodePackage.BadKind if the method 412 * is invoked on an inappropriate kind of <code>TypeCode</code> 413 * object 414 */ 415 416 public abstract int length() throws BadKind; 417 418 /** 419 * Returns the <code>TypeCode</code> object representing the 420 * IDL type for the members of the object described by this 421 * <code>TypeCode</code> object. 422 * For sequences and arrays, it returns the 423 * element type. For aliases, it returns the original type. Note 424 * that multidimensional arrays are represented by nesting 425 * <code>TypeCode</code> objects, one per dimension. 426 * For boxed valuetypes, it returns the boxed type. 427 *<P> 428 * The method <code>content_type</code> can be invoked on sequence, array, 429 * alias, and boxed valuetype <code>TypeCode</code> objects. 430 * 431 * @return a <code>TypeCode</code> object representing 432 * the element type for sequences and arrays, the 433 * original type for aliases, or the 434 * boxed type for boxed valuetypes. 435 * @throws org.omg.CORBA.TypeCodePackage.BadKind if the method 436 * is invoked on an inappropriate kind of <code>TypeCode</code> 437 * object 438 */ 439 440 public abstract TypeCode content_type() throws BadKind; 441 442 443 /** 444 * Returns the number of digits in the fixed type described by this 445 * <code>TypeCode</code> object. For example, the typecode for 446 * the number 3000.275d could be <code>fixed<7,3></code>, where 447 * 7 is the precision and 3 is the scale. 448 * 449 * @return the total number of digits 450 * @throws org.omg.CORBA.TypeCodePackage.BadKind if this method 451 * is invoked on an inappropriate kind of <code>TypeCode</code> 452 * object 453 * 454 */ 455 public abstract short fixed_digits() throws BadKind ; 456 457 /** 458 * Returns the scale of the fixed type described by this 459 * <code>TypeCode</code> object. A positive number indicates the 460 * number of digits to the right of the decimal point. 461 * For example, the number 3000d could have the 462 * typecode <code>fixed<4,0></code>, where the first number is 463 * the precision and the second number is the scale. 464 * A negative number is also possible and adds zeroes to the 465 * left of the decimal point. In this case, <code>fixed<1,-3></code>, 466 * could be the typecode for the number 3000d. 467 * 468 * @return the scale of the fixed type that this 469 * <code>TypeCode</code> object describes 470 * @throws org.omg.CORBA.TypeCodePackage.BadKind if this method 471 * is invoked on an inappropriate kind of <code>TypeCode</code> 472 * object 473 */ 474 public abstract short fixed_scale() throws BadKind ; 475 476 /** 477 * Returns the constant that indicates the visibility of the member 478 * at the given index. 479 * 480 * This operation can only be invoked on non-boxed value 481 * <code>TypeCode</code> objects. 482 * 483 * @param index an <code>int</code> indicating the index into the 484 * value 485 * @return either <code>PRIVATE_MEMBER.value</code> or 486 * <code>PUBLIC_MEMBER.value</code> 487 * @throws org.omg.CORBA.TypeCodePackage.BadKind if this method 488 * is invoked on a non-value type <code>TypeCode</code> 489 * object 490 * @throws org.omg.CORBA.TypeCodePackage.Bounds 491 * if the given index is out of bounds 492 * @see <a href="package-summary.html#unimpl"><code>CORBA</code> package 493 * comments for unimplemented features</a> 494 */ 495 496 abstract public short member_visibility(int index) 497 throws BadKind, org.omg.CORBA.TypeCodePackage.Bounds ; 498 499 /** 500 * Returns a constant indicating the modifier of the value type 501 * that this <code>TypeCode</code> object describes. The constant 502 * returned must be one of the following: <code>VM_NONE.value</code>, 503 * <code>VM_ABSTRACT.value</code>, <code>VM_CUSTOM.value</code>, 504 * or <code>VM_TRUNCATABLE.value</code>, 505 * 506 * @return a constant describing the value type 507 * that this <code>TypeCode</code> object describes 508 * @throws org.omg.CORBA.TypeCodePackage.BadKind 509 * if this method 510 * is invoked on a non-value type <code>TypeCode</code> 511 * object 512 * @see <a href="package-summary.html#unimpl"><code>CORBA</code> package 513 * comments for unimplemented features</a> 514 */ 515 516 abstract public short type_modifier() throws BadKind ; 517 518 /** 519 * Returns the <code>TypeCode</code> object that describes the concrete base type 520 * of the value type that this <code>TypeCode</code> object describes. 521 * Returns null if it doesn't have a concrete base type. 522 * 523 * @return the <code>TypeCode</code> object that describes the 524 * concrete base type of the value type 525 * that this <code>TypeCode</code> object describes 526 * @throws org.omg.CORBA.TypeCodePackage.BadKind if this method 527 * is invoked on a non-boxed value type <code>TypeCode</code> object 528 * @see <a href="package-summary.html#unimpl"><code>CORBA</code> package 529 * comments for unimplemented features</a> 530 */ 531 532 abstract public TypeCode concrete_base_type() throws BadKind ; 533 } | 1 /* 2 * Copyright (c) 1996, 2015, 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 */ 25 26 package org.omg.CORBA; 27 28 import org.omg.CORBA.TypeCodePackage.*; 29 import org.omg.CORBA.portable.IDLEntity; 30 31 /** 32 * A container for information about a specific CORBA data 33 * type. 34 * <P> 35 * <code>TypeCode</code> objects are used: 36 * <UL> 37 * <LI>in the Dynamic Invocation Interface -- to indicate the types 38 * of the actual arguments or the type of the return value. <BR> 39 * <code>NamedValue</code> objects are used to represent arguments and 40 * return values. One of their components is an <code>Any</code> 41 * object, which in turn has as one of its components a 42 * <code>TypeCode</code> object. 43 * <LI>by an Interface Repository to represent the type specifications 44 * that are part of many OMG IDL declarations 45 * </UL> 46 * <P> 47 * The representation of a <code>TypeCode</code> object is opaque, 48 * but abstractly, a <code>TypeCode</code> object consists of: 49 * <UL> 50 * <LI>a <code>kind</code> field, which is set to an instance 51 * of the class <code>TCKind</code> 52 * <LI>zero or more additional fields appropriate 53 * for the particular kind. For example, the 54 * <code>TypeCode</code> object 55 * describing the OMG IDL type <code>1ong</code> has kind 56 * <code>TCKind.tk_long</code> and no additional fields. 57 * The <code>TypeCode</code> describing OMG IDL type 58 * <code>sequence<boolean, 10></code> has a <code>kind</code> field 59 * with the value 60 * <code>TCKind.tk_sequence</code> and also fields with the values 61 * <code>boolean</code> and <code>10</code> for the 62 * type of sequence elements and the length of the sequence. 63 * </UL> 64 * 65 * <code>TypeCode</code> objects can be obtained in various ways: 66 * <OL> 67 * <LI>from a call to the method <code>Any.insert_X</code>, where X is 68 * a basic IDL type. This method creates a <code>TypeCode</code> object 69 * for type X and assigns it to the <code>Any</code> object's 70 * <code>type</code> field. 71 * <LI>from invocations of methods in the ORB class 72 * <P>For example, the following creates a <code>TypeCode</code> 73 * object for a <code>string</code> with a maximum of 30 characters: 74 * <PRE> 75 * org.omg.CORBA.TypeCode tcString = orb.create_string_tc(30); 76 * </PRE> 77 * <P> The following creates a <code>TypeCode</code> 78 * object for an <code>array</code> of five <code>string</code>s: 79 * <PRE> 80 * org.omg.CORBA.TypeCode tcArray = orb.create_array_tc( 81 * 5, TCKind.tk_string); 82 * </PRE> 147 * <P> 148 * These methods may be invoked on <code>string</code>, 149 * <code>sequence</code>, and <code>array</code>: 150 * <UL> 151 * <LI><code>length</code> 152 * </UL> 153 * <P> 154 * These methods may be invoked on <code>alias</code>, 155 * <code>sequence</code>, <code>array</code>, and <code>value_box</code>: 156 * <UL> 157 * <LI><code>content_type</code> 158 * </UL> 159 * <P> 160 * Unlike other CORBA pseudo-objects, <code>TypeCode</code> 161 * objects can be passed as general IDL parameters. <p> 162 * The methods <code>parameter</code> and <code>param_count</code>, 163 * which are deprecated, are not mapped. <p> 164 * 165 * Java IDL extends the CORBA specification to allow all operations permitted 166 * on a <code>struct</code> <code>TypeCode</code> to be permitted 167 * on an <code>exception</code> <code>TypeCode</code> as well. 168 */ 169 public abstract class TypeCode implements IDLEntity { 170 171 /** 172 * Compares this <code>TypeCode</code> object with the given one, 173 * testing for equality. <code>TypeCode</code> objects are equal if 174 * they are interchangeable and give identical results when 175 * <code>TypeCode</code> operations are applied to them. 176 * 177 * @param tc the <code>TypeCode</code> object to compare against 178 * @return <code>true</code> if the type codes are equal; 179 * <code>false</code> otherwise 180 */ 181 public abstract boolean equal(TypeCode tc); 182 183 /** 184 * Tests to see if the given <code>TypeCode</code> object is 185 * equivalent to this <code>TypeCode</code> object. 186 * 187 * 188 * @param tc the typecode to compare with this typecode 189 * 190 * @return <code>true</code> if the given typecode is equivalent to 191 * this typecode; <code>false</code> otherwise 192 * 193 */ 194 public abstract boolean equivalent(TypeCode tc); 195 196 /** 197 * Strips out all optional name and member name fields, 198 * but leaves all alias typecodes intact. 199 * @return a <code>TypeCode</code> object with optional name and 200 * member name fields stripped out, except for alias typecodes, 201 * which are left intact 202 * @see <a href="package-summary.html#unimpl"><code>CORBA</code> package 203 * comments for unimplemented features</a> 204 */ 205 public abstract TypeCode get_compact_typecode(); 206 207 208 /** 209 * Retrieves the kind of this <code>TypeCode</code> object. 210 * The kind of a type code determines which <code>TypeCode</code> 211 * methods may legally be invoked on it. 212 * <P> 213 * The method <code>kind</code> may be invoked on any 214 * <code>TypeCode</code> object. 215 * 216 * @return the <code>TCKind</code> instance indicating the 217 * value of the <code>kind</code> field of this 218 * <code>TypeCode</code> object 219 */ 220 public abstract TCKind kind(); 221 222 /** 223 * Retrieves the RepositoryId globally identifying the type 224 * of this <code>TypeCode</code> object. 225 * <P> 226 * The method <code>id</code> can be invoked on object reference, 227 * structure, union, enumeration, alias, exception, valuetype, 228 * boxed valuetype, native, and abstract interface type codes. 229 * Object reference, exception, valuetype, boxed valuetype, 230 * native, and abstract interface <code>TypeCode</code> objects 231 * always have a RepositoryId. 232 * Structure, union, enumeration, and alias <code>TypeCode</code> objects 233 * obtained from the Interface Repository or the method 234 * <code>ORB.create_operation_list</code> 235 * also always have a RepositoryId. If there is no RepositoryId, the 236 * method can return an empty string. 237 * 238 * @return the RepositoryId for this <code>TypeCode</code> object 239 * or an empty string if there is no RepositoryID 240 * @throws org.omg.CORBA.TypeCodePackage.BadKind if the method 241 * is invoked on an inappropriate kind of<code>TypeCode</code> 242 * object 243 */ 244 public abstract String id() throws BadKind; 245 246 /** 247 * Retrieves the simple name identifying this <code>TypeCode</code> 248 * object within its 249 * enclosing scope. Since names are local to a Repository, the 250 * name returned from a <code>TypeCode</code> object 251 * may not match the name of the 252 * type in any particular Repository, and may even be an empty 253 * string. 254 * <P> 255 * The method <code>name</code> can be invoked on object reference, 256 * structure, union, enumeration, alias, exception, valuetype, 257 * boxed valuetype, native, and abstract interface 258 * <code>TypeCode</code> objects. 259 * 260 * @return the name identifying this <code>TypeCode</code> object 261 * or an empty string 262 * @throws org.omg.CORBA.TypeCodePackage.BadKind if the method 263 * is invoked on an inappropriate kind of<code>TypeCode</code> 264 * object 265 */ 266 public abstract String name() throws BadKind; 267 268 /** 269 * Retrieves the number of members in the type described by 270 * this <code>TypeCode</code> object. 271 * <P> 272 * The method <code>member_count</code> can be invoked on 273 * structure, union, and enumeration <code>TypeCode</code> objects. 274 * Java IDL extends the CORBA specification to allow this method to 275 * operate on exceptions as well. 276 * 277 * @return the number of members constituting the type described 278 * by this <code>TypeCode</code> object 279 * 280 * @throws org.omg.CORBA.TypeCodePackage.BadKind if the method 281 * is invoked on an inappropriate kind of <code>TypeCode</code> 282 * object 283 */ 284 public abstract int member_count() throws BadKind; 285 286 /** 287 * Retrieves the simple name of the member identified by 288 * the given index. Since names are local to a 289 * Repository, the name returned from a <code>TypeCode</code> object 290 * may not match the name of the member in any particular 291 * Repository, and may even be an empty string. 292 * <P> 293 * The method <code>member_name</code> can be invoked on structure, union, 294 * and enumeration <code>TypeCode</code> objects. 295 * Java IDL extends the CORBA specification to allow this method to 296 * operate on exceptions as well. 297 * 298 * @param index index of the member for which a name is being reqested 299 * @return simple name of the member identified by the 300 * index or an empty string 301 * @throws org.omg.CORBA.TypeCodePackage.Bounds if the index is equal 302 * to or greater than 303 * the number of members constituting the type 304 * @throws org.omg.CORBA.TypeCodePackage.BadKind if the method 305 * is invoked on an inappropriate kind of <code>TypeCode</code> 306 * object 307 */ 308 public abstract String member_name(int index) 309 throws BadKind, org.omg.CORBA.TypeCodePackage.Bounds; 310 311 /** 312 * Retrieves the <code>TypeCode</code> object describing the type 313 * of the member identified by the given index. 314 * <P> 315 * The method <code>member_type</code> can be invoked on structure 316 * and union <code>TypeCode</code> objects. 317 * Java IDL extends the CORBA specification to allow this method to 318 * operate on exceptions as well. 319 * 320 * @param index index of the member for which type information 321 * is begin requested 322 * @return the <code>TypeCode</code> object describing the 323 * member at the given index 324 * @throws org.omg.CORBA.TypeCodePackage.Bounds if the index is 325 * equal to or greater than 326 * the number of members constituting the type 327 * @throws org.omg.CORBA.TypeCodePackage.BadKind if the method 328 * is invoked on an inappropriate kind of <code>TypeCode</code> 329 * object 330 */ 331 public abstract TypeCode member_type(int index) 332 throws BadKind, org.omg.CORBA.TypeCodePackage.Bounds; 333 334 /** 335 * Retrieves the label of the union member 336 * identified by the given index. For the default member, 337 * the label is the zero octet. 338 * <P> 339 * The method <code>member_label</code> can only be invoked on union 340 * <code>TypeCode</code> objects. 341 * 342 * @param index index of the union member for which the 343 * label is being requested 344 * @return an <code>Any</code> object describing the label of 345 * the requested union member or the zero octet for 346 * the default member 347 * @throws org.omg.CORBA.TypeCodePackage.Bounds if the index is 348 * equal to or greater than 349 * the number of members constituting the union 350 * @throws org.omg.CORBA.TypeCodePackage.BadKind if the method 351 * is invoked on a non-union <code>TypeCode</code> 352 * object 353 */ 354 public abstract Any member_label(int index) 355 throws BadKind, org.omg.CORBA.TypeCodePackage.Bounds; 356 357 /** 358 * Returns a <code>TypeCode</code> object describing 359 * all non-default member labels. 360 * The method <code>discriminator_type</code> can be invoked only 361 * on union <code>TypeCode</code> objects. 362 * 363 * @return the <code>TypeCode</code> object describing 364 * the non-default member labels 365 * @throws org.omg.CORBA.TypeCodePackage.BadKind if the method 366 * is invoked on a non-union <code>TypeCode</code> 367 * object 368 */ 369 public abstract TypeCode discriminator_type() 370 throws BadKind; 371 372 /** 373 * Returns the index of the 374 * default member, or -1 if there is no default member. 375 * <P> 376 * The method <code>default_index</code> can be invoked only on union 377 * <code>TypeCode</code> objects. 378 * 379 * @return the index of the default member, or -1 if 380 * there is no default member 381 * @throws org.omg.CORBA.TypeCodePackage.BadKind if the method 382 * is invoked on a non-union <code>TypeCode</code> 383 * object 384 */ 385 public abstract int default_index() throws BadKind; 386 387 /** 388 * Returns the number of elements in the type described by 389 * this <code>TypeCode</code> object. 390 * For strings and sequences, it returns the 391 * bound, with zero indicating an unbounded string or sequence. 392 * For arrays, it returns the number of elements in the array. 393 * <P> 394 * The method <code>length</code> can be invoked on string, sequence, and 395 * array <code>TypeCode</code> objects. 396 * 397 * @return the bound for strings and sequences, or the 398 * number of elements for arrays 399 * @throws org.omg.CORBA.TypeCodePackage.BadKind if the method 400 * is invoked on an inappropriate kind of <code>TypeCode</code> 401 * object 402 */ 403 public abstract int length() throws BadKind; 404 405 /** 406 * Returns the <code>TypeCode</code> object representing the 407 * IDL type for the members of the object described by this 408 * <code>TypeCode</code> object. 409 * For sequences and arrays, it returns the 410 * element type. For aliases, it returns the original type. Note 411 * that multidimensional arrays are represented by nesting 412 * <code>TypeCode</code> objects, one per dimension. 413 * For boxed valuetypes, it returns the boxed type. 414 * <P> 415 * The method <code>content_type</code> can be invoked on sequence, array, 416 * alias, and boxed valuetype <code>TypeCode</code> objects. 417 * 418 * @return a <code>TypeCode</code> object representing 419 * the element type for sequences and arrays, the 420 * original type for aliases, or the 421 * boxed type for boxed valuetypes. 422 * @throws org.omg.CORBA.TypeCodePackage.BadKind if the method 423 * is invoked on an inappropriate kind of <code>TypeCode</code> 424 * object 425 */ 426 public abstract TypeCode content_type() throws BadKind; 427 428 429 /** 430 * Returns the number of digits in the fixed type described by this 431 * <code>TypeCode</code> object. For example, the typecode for 432 * the number 3000.275d could be <code>fixed<7,3></code>, where 433 * 7 is the precision and 3 is the scale. 434 * 435 * @return the total number of digits 436 * @throws org.omg.CORBA.TypeCodePackage.BadKind if this method 437 * is invoked on an inappropriate kind of <code>TypeCode</code> 438 * object 439 * 440 */ 441 public abstract short fixed_digits() throws BadKind ; 442 443 /** 444 * Returns the scale of the fixed type described by this 445 * <code>TypeCode</code> object. A positive number indicates the 446 * number of digits to the right of the decimal point. 447 * For example, the number 3000d could have the 448 * typecode <code>fixed<4,0></code>, where the first number is 449 * the precision and the second number is the scale. 450 * A negative number is also possible and adds zeroes to the 451 * left of the decimal point. In this case, <code>fixed<1,-3></code>, 452 * could be the typecode for the number 3000d. 453 * 454 * @return the scale of the fixed type that this 455 * <code>TypeCode</code> object describes 456 * @throws org.omg.CORBA.TypeCodePackage.BadKind if this method 457 * is invoked on an inappropriate kind of <code>TypeCode</code> 458 * object 459 */ 460 public abstract short fixed_scale() throws BadKind ; 461 462 /** 463 * Returns the constant that indicates the visibility of the member 464 * at the given index. 465 * 466 * This operation can only be invoked on non-boxed value 467 * <code>TypeCode</code> objects. 468 * 469 * @param index an <code>int</code> indicating the index into the 470 * value 471 * @return either <code>PRIVATE_MEMBER.value</code> or 472 * <code>PUBLIC_MEMBER.value</code> 473 * @throws org.omg.CORBA.TypeCodePackage.BadKind if this method 474 * is invoked on a non-value type <code>TypeCode</code> 475 * object 476 * @throws org.omg.CORBA.TypeCodePackage.Bounds 477 * if the given index is out of bounds 478 * @see <a href="package-summary.html#unimpl"><code>CORBA</code> package 479 * comments for unimplemented features</a> 480 */ 481 abstract public short member_visibility(int index) 482 throws BadKind, org.omg.CORBA.TypeCodePackage.Bounds ; 483 484 /** 485 * Returns a constant indicating the modifier of the value type 486 * that this <code>TypeCode</code> object describes. The constant 487 * returned must be one of the following: <code>VM_NONE.value</code>, 488 * <code>VM_ABSTRACT.value</code>, <code>VM_CUSTOM.value</code>, 489 * or <code>VM_TRUNCATABLE.value</code>, 490 * 491 * @return a constant describing the value type 492 * that this <code>TypeCode</code> object describes 493 * @throws org.omg.CORBA.TypeCodePackage.BadKind 494 * if this method 495 * is invoked on a non-value type <code>TypeCode</code> 496 * object 497 * @see <a href="package-summary.html#unimpl"><code>CORBA</code> package 498 * comments for unimplemented features</a> 499 */ 500 abstract public short type_modifier() throws BadKind ; 501 502 /** 503 * Returns the <code>TypeCode</code> object that describes the concrete base type 504 * of the value type that this <code>TypeCode</code> object describes. 505 * Returns null if it doesn't have a concrete base type. 506 * 507 * @return the <code>TypeCode</code> object that describes the 508 * concrete base type of the value type 509 * that this <code>TypeCode</code> object describes 510 * @throws org.omg.CORBA.TypeCodePackage.BadKind if this method 511 * is invoked on a non-boxed value type <code>TypeCode</code> object 512 * @see <a href="package-summary.html#unimpl"><code>CORBA</code> package 513 * comments for unimplemented features</a> 514 */ 515 abstract public TypeCode concrete_base_type() throws BadKind ; 516 } |