1 /* |
1 /* |
2 * Copyright (c) 1996, 2003, Oracle and/or its affiliates. All rights reserved. |
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. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * |
4 * |
5 * This code is free software; you can redistribute it and/or modify it |
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 |
6 * under the terms of the GNU General Public License version 2 only, as |
7 * published by the Free Software Foundation. Oracle designates this |
7 * published by the Free Software Foundation. Oracle designates this |
29 import org.omg.CORBA.portable.IDLEntity; |
29 import org.omg.CORBA.portable.IDLEntity; |
30 |
30 |
31 /** |
31 /** |
32 * A container for information about a specific CORBA data |
32 * A container for information about a specific CORBA data |
33 * type. |
33 * type. |
34 *<P> |
34 * <P> |
35 * <code>TypeCode</code> objects are used: |
35 * <code>TypeCode</code> objects are used: |
36 * <UL> |
36 * <UL> |
37 * <LI>in the Dynamic Invocation Interface -- to indicate the types |
37 * <LI>in the Dynamic Invocation Interface -- to indicate the types |
38 * of the actual arguments or the type of the return value. <BR> |
38 * of the actual arguments or the type of the return value. <BR> |
39 * <code>NamedValue</code> objects are used to represent arguments and |
39 * <code>NamedValue</code> objects are used to represent arguments and |
57 * The <code>TypeCode</code> describing OMG IDL type |
57 * The <code>TypeCode</code> describing OMG IDL type |
58 * <code>sequence<boolean, 10></code> has a <code>kind</code> field |
58 * <code>sequence<boolean, 10></code> has a <code>kind</code> field |
59 * with the value |
59 * with the value |
60 * <code>TCKind.tk_sequence</code> and also fields with the values |
60 * <code>TCKind.tk_sequence</code> and also fields with the values |
61 * <code>boolean</code> and <code>10</code> for the |
61 * <code>boolean</code> and <code>10</code> for the |
62 * type of sequence elements and the length of the sequence. <p> |
62 * type of sequence elements and the length of the sequence. |
63 * </UL> |
63 * </UL> |
64 * |
64 * |
65 * <code>TypeCode</code> objects can be obtained in various ways: |
65 * <code>TypeCode</code> objects can be obtained in various ways: |
66 * <OL> |
66 * <OL> |
67 * <LI>from a call to the method <code>Any.insert_X</code>, where X is |
67 * <LI>from a call to the method <code>Any.insert_X</code>, where X is |
162 * The methods <code>parameter</code> and <code>param_count</code>, |
162 * The methods <code>parameter</code> and <code>param_count</code>, |
163 * which are deprecated, are not mapped. <p> |
163 * which are deprecated, are not mapped. <p> |
164 * |
164 * |
165 * Java IDL extends the CORBA specification to allow all operations permitted |
165 * Java IDL extends the CORBA specification to allow all operations permitted |
166 * on a <code>struct</code> <code>TypeCode</code> to be 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> |
167 * on an <code>exception</code> <code>TypeCode</code> as well. |
168 * |
|
169 */ |
168 */ |
170 public abstract class TypeCode implements IDLEntity { |
169 public abstract class TypeCode implements IDLEntity { |
171 |
170 |
172 /** |
171 /** |
173 * Compares this <code>TypeCode</code> object with the given one, |
172 * Compares this <code>TypeCode</code> object with the given one, |
174 * testing for equality. <code>TypeCode</code> objects are equal if |
173 * testing for equality. <code>TypeCode</code> objects are equal if |
175 * they are interchangeable and give identical results when |
174 * they are interchangeable and give identical results when |
176 * <code>TypeCode</code> operations are applied to them. |
175 * <code>TypeCode</code> operations are applied to them. |
177 * |
176 * |
178 * @param tc the <code>TypeCode</code> object to compare against |
177 * @param tc the <code>TypeCode</code> object to compare against |
179 * @return <code>true</code> if the type codes are equal; |
178 * @return <code>true</code> if the type codes are equal; |
180 * <code>false</code> otherwise |
179 * <code>false</code> otherwise |
181 */ |
180 */ |
182 |
|
183 public abstract boolean equal(TypeCode tc); |
181 public abstract boolean equal(TypeCode tc); |
184 |
182 |
185 /** |
183 /** |
186 * Tests to see if the given <code>TypeCode</code> object is |
184 * Tests to see if the given <code>TypeCode</code> object is |
187 * equivalent to this <code>TypeCode</code> object. |
185 * equivalent to this <code>TypeCode</code> object. |
188 * <P> |
186 * |
189 * |
187 * |
190 * |
188 * @param tc the typecode to compare with this typecode |
191 * @param tc the typecode to compare with this typecode |
189 * |
192 * |
190 * @return <code>true</code> if the given typecode is equivalent to |
193 * @return <code>true</code> if the given typecode is equivalent to |
191 * this typecode; <code>false</code> otherwise |
194 * this typecode; <code>false</code> otherwise |
|
195 * |
192 * |
196 */ |
193 */ |
197 public abstract boolean equivalent(TypeCode tc); |
194 public abstract boolean equivalent(TypeCode tc); |
198 |
195 |
199 /** |
196 /** |
200 * Strips out all optional name and member name fields, |
197 * Strips out all optional name and member name fields, |
201 * but leaves all alias typecodes intact. |
198 * but leaves all alias typecodes intact. |
202 * @return a <code>TypeCode</code> object with optional name and |
199 * @return a <code>TypeCode</code> object with optional name and |
203 * member name fields stripped out, except for alias typecodes, |
200 * member name fields stripped out, except for alias typecodes, |
204 * which are left intact |
201 * which are left intact |
205 * @see <a href="package-summary.html#unimpl"><code>CORBA</code> package |
202 * @see <a href="package-summary.html#unimpl"><code>CORBA</code> package |
206 * comments for unimplemented features</a> |
203 * comments for unimplemented features</a> |
207 */ |
204 */ |
208 public abstract TypeCode get_compact_typecode(); |
205 public abstract TypeCode get_compact_typecode(); |
209 |
206 |
237 * obtained from the Interface Repository or the method |
233 * obtained from the Interface Repository or the method |
238 * <code>ORB.create_operation_list</code> |
234 * <code>ORB.create_operation_list</code> |
239 * also always have a RepositoryId. If there is no RepositoryId, the |
235 * also always have a RepositoryId. If there is no RepositoryId, the |
240 * method can return an empty string. |
236 * method can return an empty string. |
241 * |
237 * |
242 * @return the RepositoryId for this <code>TypeCode</code> object |
238 * @return the RepositoryId for this <code>TypeCode</code> object |
243 * or an empty string if there is no RepositoryID |
239 * or an empty string if there is no RepositoryID |
244 * @throws org.omg.CORBA.TypeCodePackage.BadKind if the method |
240 * @throws org.omg.CORBA.TypeCodePackage.BadKind if the method |
245 * is invoked on an inappropriate kind of<code>TypeCode</code> |
241 * is invoked on an inappropriate kind of<code>TypeCode</code> |
246 * object |
242 * object |
247 */ |
243 */ |
248 |
|
249 public abstract String id() throws BadKind; |
244 public abstract String id() throws BadKind; |
250 |
245 |
251 /** |
246 /** |
252 * Retrieves the simple name identifying this <code>TypeCode</code> |
247 * Retrieves the simple name identifying this <code>TypeCode</code> |
253 * object within its |
248 * object within its |
310 * the number of members constituting the type |
303 * the number of members constituting the type |
311 * @throws org.omg.CORBA.TypeCodePackage.BadKind if the method |
304 * @throws org.omg.CORBA.TypeCodePackage.BadKind if the method |
312 * is invoked on an inappropriate kind of <code>TypeCode</code> |
305 * is invoked on an inappropriate kind of <code>TypeCode</code> |
313 * object |
306 * object |
314 */ |
307 */ |
315 |
|
316 public abstract String member_name(int index) |
308 public abstract String member_name(int index) |
317 throws BadKind, org.omg.CORBA.TypeCodePackage.Bounds; |
309 throws BadKind, org.omg.CORBA.TypeCodePackage.Bounds; |
318 |
310 |
319 /** |
311 /** |
320 * Retrieves the <code>TypeCode</code> object describing the type |
312 * Retrieves the <code>TypeCode</code> object describing the type |
334 * the number of members constituting the type |
326 * the number of members constituting the type |
335 * @throws org.omg.CORBA.TypeCodePackage.BadKind if the method |
327 * @throws org.omg.CORBA.TypeCodePackage.BadKind if the method |
336 * is invoked on an inappropriate kind of <code>TypeCode</code> |
328 * is invoked on an inappropriate kind of <code>TypeCode</code> |
337 * object |
329 * object |
338 */ |
330 */ |
339 |
|
340 public abstract TypeCode member_type(int index) |
331 public abstract TypeCode member_type(int index) |
341 throws BadKind, org.omg.CORBA.TypeCodePackage.Bounds; |
332 throws BadKind, org.omg.CORBA.TypeCodePackage.Bounds; |
342 |
333 |
343 /** |
334 /** |
344 * Retrieves the label of the union member |
335 * Retrieves the label of the union member |
345 * identified by the given index. For the default member, |
336 * identified by the given index. For the default member, |
346 * the label is the zero octet. |
337 * the label is the zero octet. |
347 *<P> |
338 * <P> |
348 * The method <code>member_label</code> can only be invoked on union |
339 * The method <code>member_label</code> can only be invoked on union |
349 * <code>TypeCode</code> objects. |
340 * <code>TypeCode</code> objects. |
350 * |
341 * |
351 * @param index index of the union member for which the |
342 * @param index index of the union member for which the |
352 * label is being requested |
343 * label is being requested |
353 * @return an <code>Any</code> object describing the label of |
344 * @return an <code>Any</code> object describing the label of |
354 * the requested union member or the zero octet for |
345 * the requested union member or the zero octet for |
355 * the default member |
346 * the default member |
356 * @throws org.omg.CORBA.TypeCodePackage.Bounds if the index is |
347 * @throws org.omg.CORBA.TypeCodePackage.Bounds if the index is |
357 * equal to or greater than |
348 * equal to or greater than |
358 * the number of members constituting the union |
349 * the number of members constituting the union |
359 * @throws org.omg.CORBA.TypeCodePackage.BadKind if the method |
350 * @throws org.omg.CORBA.TypeCodePackage.BadKind if the method |
360 * is invoked on a non-union <code>TypeCode</code> |
351 * is invoked on a non-union <code>TypeCode</code> |
361 * object |
352 * object |
362 */ |
353 */ |
363 |
|
364 public abstract Any member_label(int index) |
354 public abstract Any member_label(int index) |
365 throws BadKind, org.omg.CORBA.TypeCodePackage.Bounds; |
355 throws BadKind, org.omg.CORBA.TypeCodePackage.Bounds; |
366 |
356 |
367 /** |
357 /** |
368 * Returns a <code>TypeCode</code> object describing |
358 * Returns a <code>TypeCode</code> object describing |
422 * For sequences and arrays, it returns the |
409 * For sequences and arrays, it returns the |
423 * element type. For aliases, it returns the original type. Note |
410 * element type. For aliases, it returns the original type. Note |
424 * that multidimensional arrays are represented by nesting |
411 * that multidimensional arrays are represented by nesting |
425 * <code>TypeCode</code> objects, one per dimension. |
412 * <code>TypeCode</code> objects, one per dimension. |
426 * For boxed valuetypes, it returns the boxed type. |
413 * For boxed valuetypes, it returns the boxed type. |
427 *<P> |
414 * <P> |
428 * The method <code>content_type</code> can be invoked on sequence, array, |
415 * The method <code>content_type</code> can be invoked on sequence, array, |
429 * alias, and boxed valuetype <code>TypeCode</code> objects. |
416 * alias, and boxed valuetype <code>TypeCode</code> objects. |
430 * |
417 * |
431 * @return a <code>TypeCode</code> object representing |
418 * @return a <code>TypeCode</code> object representing |
432 * the element type for sequences and arrays, the |
419 * the element type for sequences and arrays, the |
434 * boxed type for boxed valuetypes. |
421 * boxed type for boxed valuetypes. |
435 * @throws org.omg.CORBA.TypeCodePackage.BadKind if the method |
422 * @throws org.omg.CORBA.TypeCodePackage.BadKind if the method |
436 * is invoked on an inappropriate kind of <code>TypeCode</code> |
423 * is invoked on an inappropriate kind of <code>TypeCode</code> |
437 * object |
424 * object |
438 */ |
425 */ |
439 |
|
440 public abstract TypeCode content_type() throws BadKind; |
426 public abstract TypeCode content_type() throws BadKind; |
441 |
427 |
442 |
428 |
443 /** |
429 /** |
444 * Returns the number of digits in the fixed type described by this |
430 * Returns the number of digits in the fixed type described by this |
445 * <code>TypeCode</code> object. For example, the typecode for |
431 * <code>TypeCode</code> object. For example, the typecode for |
446 * the number 3000.275d could be <code>fixed<7,3></code>, where |
432 * the number 3000.275d could be <code>fixed<7,3></code>, where |
447 * 7 is the precision and 3 is the scale. |
433 * 7 is the precision and 3 is the scale. |
448 * |
434 * |
449 * @return the total number of digits |
435 * @return the total number of digits |
450 * @throws org.omg.CORBA.TypeCodePackage.BadKind if this method |
436 * @throws org.omg.CORBA.TypeCodePackage.BadKind if this method |
451 * is invoked on an inappropriate kind of <code>TypeCode</code> |
437 * is invoked on an inappropriate kind of <code>TypeCode</code> |
452 * object |
438 * object |
453 * |
439 * |
454 */ |
440 */ |
455 public abstract short fixed_digits() throws BadKind ; |
441 public abstract short fixed_digits() throws BadKind ; |
456 |
442 |
457 /** |
443 /** |
458 * Returns the scale of the fixed type described by this |
444 * Returns the scale of the fixed type described by this |
459 * <code>TypeCode</code> object. A positive number indicates the |
445 * <code>TypeCode</code> object. A positive number indicates the |
460 * number of digits to the right of the decimal point. |
446 * number of digits to the right of the decimal point. |
461 * For example, the number 3000d could have the |
447 * For example, the number 3000d could have the |
462 * typecode <code>fixed<4,0></code>, where the first number is |
448 * typecode <code>fixed<4,0></code>, where the first number is |
463 * the precision and the second number is the scale. |
449 * the precision and the second number is the scale. |
464 * A negative number is also possible and adds zeroes to the |
450 * 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>, |
451 * left of the decimal point. In this case, <code>fixed<1,-3></code>, |
466 * could be the typecode for the number 3000d. |
452 * could be the typecode for the number 3000d. |
467 * |
453 * |
468 * @return the scale of the fixed type that this |
454 * @return the scale of the fixed type that this |
469 * <code>TypeCode</code> object describes |
455 * <code>TypeCode</code> object describes |
470 * @throws org.omg.CORBA.TypeCodePackage.BadKind if this method |
456 * @throws org.omg.CORBA.TypeCodePackage.BadKind if this method |
471 * is invoked on an inappropriate kind of <code>TypeCode</code> |
457 * is invoked on an inappropriate kind of <code>TypeCode</code> |
472 * object |
458 * object |
473 */ |
459 */ |
474 public abstract short fixed_scale() throws BadKind ; |
460 public abstract short fixed_scale() throws BadKind ; |
490 * @throws org.omg.CORBA.TypeCodePackage.Bounds |
476 * @throws org.omg.CORBA.TypeCodePackage.Bounds |
491 * if the given index is out of bounds |
477 * if the given index is out of bounds |
492 * @see <a href="package-summary.html#unimpl"><code>CORBA</code> package |
478 * @see <a href="package-summary.html#unimpl"><code>CORBA</code> package |
493 * comments for unimplemented features</a> |
479 * comments for unimplemented features</a> |
494 */ |
480 */ |
495 |
|
496 abstract public short member_visibility(int index) |
481 abstract public short member_visibility(int index) |
497 throws BadKind, org.omg.CORBA.TypeCodePackage.Bounds ; |
482 throws BadKind, org.omg.CORBA.TypeCodePackage.Bounds ; |
498 |
483 |
499 /** |
484 /** |
500 * Returns a constant indicating the modifier of the value type |
485 * Returns a constant indicating the modifier of the value type |
510 * is invoked on a non-value type <code>TypeCode</code> |
495 * is invoked on a non-value type <code>TypeCode</code> |
511 * object |
496 * object |
512 * @see <a href="package-summary.html#unimpl"><code>CORBA</code> package |
497 * @see <a href="package-summary.html#unimpl"><code>CORBA</code> package |
513 * comments for unimplemented features</a> |
498 * comments for unimplemented features</a> |
514 */ |
499 */ |
515 |
|
516 abstract public short type_modifier() throws BadKind ; |
500 abstract public short type_modifier() throws BadKind ; |
517 |
501 |
518 /** |
502 /** |
519 * Returns the <code>TypeCode</code> object that describes the concrete base type |
503 * Returns the <code>TypeCode</code> object that describes the concrete base type |
520 * of the value type that this <code>TypeCode</code> object describes. |
504 * of the value type that this <code>TypeCode</code> object describes. |