Fri, 24 Sep 2010 22:42:14 -0700
6891766: Vulnerabilities in use of reflection in CORBA
Reviewed-by: hawtin
duke@1 | 1 | /* |
ohair@158 | 2 | * Copyright (c) 1996, 2003, Oracle and/or its affiliates. All rights reserved. |
duke@1 | 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
duke@1 | 4 | * |
duke@1 | 5 | * This code is free software; you can redistribute it and/or modify it |
duke@1 | 6 | * under the terms of the GNU General Public License version 2 only, as |
ohair@158 | 7 | * published by the Free Software Foundation. Oracle designates this |
duke@1 | 8 | * particular file as subject to the "Classpath" exception as provided |
ohair@158 | 9 | * by Oracle in the LICENSE file that accompanied this code. |
duke@1 | 10 | * |
duke@1 | 11 | * This code is distributed in the hope that it will be useful, but WITHOUT |
duke@1 | 12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
duke@1 | 13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
duke@1 | 14 | * version 2 for more details (a copy is included in the LICENSE file that |
duke@1 | 15 | * accompanied this code). |
duke@1 | 16 | * |
duke@1 | 17 | * You should have received a copy of the GNU General Public License version |
duke@1 | 18 | * 2 along with this work; if not, write to the Free Software Foundation, |
duke@1 | 19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
duke@1 | 20 | * |
ohair@158 | 21 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
ohair@158 | 22 | * or visit www.oracle.com if you need additional information or have any |
ohair@158 | 23 | * questions. |
duke@1 | 24 | */ |
duke@1 | 25 | |
duke@1 | 26 | package org.omg.CORBA; |
duke@1 | 27 | |
duke@1 | 28 | import org.omg.CORBA.TypeCodePackage.*; |
duke@1 | 29 | import org.omg.CORBA.portable.IDLEntity; |
duke@1 | 30 | |
duke@1 | 31 | /** |
duke@1 | 32 | * A container for information about a specific CORBA data |
duke@1 | 33 | * type. |
duke@1 | 34 | *<P> |
duke@1 | 35 | * <code>TypeCode</code> objects are used: |
duke@1 | 36 | * <UL> |
duke@1 | 37 | * <LI>in the Dynamic Invocation Interface -- to indicate the types |
duke@1 | 38 | * of the actual arguments or the type of the return value. <BR> |
duke@1 | 39 | * <code>NamedValue</code> objects are used to represent arguments and |
duke@1 | 40 | * return values. One of their components is an <code>Any</code> |
duke@1 | 41 | * object, which in turn has as one of its components a |
duke@1 | 42 | * <code>TypeCode</code> object. |
duke@1 | 43 | * <LI>by an Interface Repository to represent the type specifications |
duke@1 | 44 | * that are part of many OMG IDL declarations |
duke@1 | 45 | * </UL> |
duke@1 | 46 | * <P> |
duke@1 | 47 | * The representation of a <code>TypeCode</code> object is opaque, |
duke@1 | 48 | * but abstractly, a <code>TypeCode</code> object consists of: |
duke@1 | 49 | * <UL> |
duke@1 | 50 | * <LI>a <code>kind</code> field, which is set to an instance |
duke@1 | 51 | * of the class <code>TCKind</code> |
duke@1 | 52 | * <LI>zero or more additional fields appropriate |
duke@1 | 53 | * for the particular kind. For example, the |
duke@1 | 54 | * <code>TypeCode</code> object |
duke@1 | 55 | * describing the OMG IDL type <code>1ong</code> has kind |
duke@1 | 56 | * <code>TCKind.tk_long</code> and no additional fields. |
duke@1 | 57 | * The <code>TypeCode</code> describing OMG IDL type |
duke@1 | 58 | * <code>sequence<boolean, 10></code> has a <code>kind</code> field |
duke@1 | 59 | * with the value |
duke@1 | 60 | * <code>TCKind.tk_sequence</code> and also fields with the values |
duke@1 | 61 | * <code>boolean</code> and <code>10</code> for the |
duke@1 | 62 | * type of sequence elements and the length of the sequence. <p> |
duke@1 | 63 | * </UL> |
duke@1 | 64 | * |
duke@1 | 65 | * <code>TypeCode</code> objects can be obtained in various ways: |
duke@1 | 66 | * <OL> |
duke@1 | 67 | * <LI>from a call to the method <code>Any.insert_X</code>, where X is |
duke@1 | 68 | * a basic IDL type. This method creates a <code>TypeCode</code> object |
duke@1 | 69 | * for type X and assigns it to the <code>Any</code> object's |
duke@1 | 70 | * <code>type</code> field. |
duke@1 | 71 | * <LI>from invocations of methods in the ORB class |
duke@1 | 72 | * <P>For example, the following creates a <code>TypeCode</code> |
duke@1 | 73 | * object for a <code>string</code> with a maximum of 30 characters: |
duke@1 | 74 | * <PRE> |
duke@1 | 75 | * org.omg.CORBA.TypeCode tcString = orb.create_string_tc(30); |
duke@1 | 76 | * </PRE> |
duke@1 | 77 | * <P> The following creates a <code>TypeCode</code> |
duke@1 | 78 | * object for an <code>array</code> of five <code>string</code>s: |
duke@1 | 79 | * <PRE> |
duke@1 | 80 | * org.omg.CORBA.TypeCode tcArray = orb.create_array_tc( |
duke@1 | 81 | * 5, TCKind.tk_string); |
duke@1 | 82 | * </PRE> |
duke@1 | 83 | * <P> The following creates a <code>TypeCode</code> |
duke@1 | 84 | * object for an interface named "Account": |
duke@1 | 85 | * <PRE> |
duke@1 | 86 | * org.omg.CORBA.TypeCode tcInterface = orb.create_interface_tc( |
duke@1 | 87 | * "thisId", "Account"); |
duke@1 | 88 | * </PRE> |
duke@1 | 89 | * <LI>as the return value from the <code>_type</code> method |
duke@1 | 90 | * in <code>Holder</code> classes for user-defined |
duke@1 | 91 | * IDL types. These <code>Holder</code> classes are generated |
duke@1 | 92 | * by the <code>idltojava</code> compiler. |
duke@1 | 93 | * <LI>from a CORBA Interface Repository |
duke@1 | 94 | * </OL> |
duke@1 | 95 | * <P> |
duke@1 | 96 | * Most of the methods in the class <code>TypeCode</code> |
duke@1 | 97 | * are accessors, and the information contained in a <code>TypeCode</code> |
duke@1 | 98 | * object is specific to a particular type. Therefore, methods |
duke@1 | 99 | * must be invoked |
duke@1 | 100 | * only on the kind of type codes to which they apply. If an |
duke@1 | 101 | * accessor method |
duke@1 | 102 | * tries to access information from an inappropriate kind of |
duke@1 | 103 | * type code, it will throw |
duke@1 | 104 | * the exception <code>TypeCodePackage.BadKind</code>. For example, |
duke@1 | 105 | * if the method <code>discriminator_type</code> is called on anything |
duke@1 | 106 | * other than a <code>union</code>, it will throw <code>BadKind</code> |
duke@1 | 107 | * because only <code>union</code>s have a discriminator. |
duke@1 | 108 | * The following list shows which methods apply to which kinds of |
duke@1 | 109 | * type codes: |
duke@1 | 110 | * <P> |
duke@1 | 111 | * These methods may be invoked on all <code>TypeCode</code> kinds: |
duke@1 | 112 | * <UL> |
duke@1 | 113 | * <LI><code>equal</code> |
duke@1 | 114 | * <LI><code>kind</code> |
duke@1 | 115 | * </UL> |
duke@1 | 116 | * <P> |
duke@1 | 117 | * These methods may be invoked on <code>objref</code>, <code>struct</code>, |
duke@1 | 118 | * <code>union</code>, <code>enum</code>, |
duke@1 | 119 | * <code>alias</code>, <code>exception</code>, <code>value</code>, |
duke@1 | 120 | * <code>value_box</code>, <code>native</code>, |
duke@1 | 121 | * and <code>abstract_interface</code>: |
duke@1 | 122 | * <UL> |
duke@1 | 123 | * <LI><code>id</code> |
duke@1 | 124 | * <LI><code>name</code> |
duke@1 | 125 | * </UL> |
duke@1 | 126 | * <P> |
duke@1 | 127 | * These methods may be invoked on <code>struct</code>, |
duke@1 | 128 | * <code>union</code>, <code>enum</code>, |
duke@1 | 129 | * and <code>exception</code>: |
duke@1 | 130 | * <UL> |
duke@1 | 131 | * <LI><code>member_count</code> |
duke@1 | 132 | * <LI><code>member_name</code> |
duke@1 | 133 | * </UL> |
duke@1 | 134 | * <P> |
duke@1 | 135 | * These methods may be invoked on <code>struct</code>, |
duke@1 | 136 | * <code>union</code>, and <code>exception</code>: |
duke@1 | 137 | * <UL> |
duke@1 | 138 | * <LI><code>member_type(int index)</code> |
duke@1 | 139 | * </UL> |
duke@1 | 140 | * <P> |
duke@1 | 141 | * These methods may be invoked on <code>union</code>: |
duke@1 | 142 | * <UL> |
duke@1 | 143 | * <LI><code>member_label</code> |
duke@1 | 144 | * <LI><code>discriminator_type</code> |
duke@1 | 145 | * <LI><code>default_index</code> |
duke@1 | 146 | * </UL> |
duke@1 | 147 | * <P> |
duke@1 | 148 | * These methods may be invoked on <code>string</code>, |
duke@1 | 149 | * <code>sequence</code>, and <code>array</code>: |
duke@1 | 150 | * <UL> |
duke@1 | 151 | * <LI><code>length</code> |
duke@1 | 152 | * </UL> |
duke@1 | 153 | * <P> |
duke@1 | 154 | * These methods may be invoked on <code>alias</code>, |
duke@1 | 155 | * <code>sequence</code>, <code>array</code>, and <code>value_box</code>: |
duke@1 | 156 | * <UL> |
duke@1 | 157 | * <LI><code>content_type</code> |
duke@1 | 158 | * </UL> |
duke@1 | 159 | * <P> |
duke@1 | 160 | * Unlike other CORBA pseudo-objects, <code>TypeCode</code> |
duke@1 | 161 | * objects can be passed as general IDL parameters. <p> |
duke@1 | 162 | * The methods <code>parameter</code> and <code>param_count</code>, |
duke@1 | 163 | * which are deprecated, are not mapped. <p> |
duke@1 | 164 | * |
duke@1 | 165 | * Java IDL extends the CORBA specification to allow all operations permitted |
duke@1 | 166 | * on a <code>struct</code> <code>TypeCode</code> to be permitted |
duke@1 | 167 | * on an <code>exception</code> <code>TypeCode</code> as well. <p> |
duke@1 | 168 | * |
duke@1 | 169 | */ |
duke@1 | 170 | public abstract class TypeCode implements IDLEntity { |
duke@1 | 171 | |
duke@1 | 172 | /** |
duke@1 | 173 | * Compares this <code>TypeCode</code> object with the given one, |
duke@1 | 174 | * testing for equality. <code>TypeCode</code> objects are equal if |
duke@1 | 175 | * they are interchangeable and give identical results when |
duke@1 | 176 | * <code>TypeCode</code> operations are applied to them. |
duke@1 | 177 | * |
duke@1 | 178 | * @param tc the <code>TypeCode</code> object to compare against |
duke@1 | 179 | * @return <code>true</code> if the type codes are equal; |
duke@1 | 180 | * <code>false</code> otherwise |
duke@1 | 181 | */ |
duke@1 | 182 | |
duke@1 | 183 | public abstract boolean equal(TypeCode tc); |
duke@1 | 184 | |
duke@1 | 185 | /** |
duke@1 | 186 | * Tests to see if the given <code>TypeCode</code> object is |
duke@1 | 187 | * equivalent to this <code>TypeCode</code> object. |
duke@1 | 188 | * <P> |
duke@1 | 189 | * |
duke@1 | 190 | * |
duke@1 | 191 | * @param tc the typecode to compare with this typecode |
duke@1 | 192 | * |
duke@1 | 193 | * @return <code>true</code> if the given typecode is equivalent to |
duke@1 | 194 | * this typecode; <code>false</code> otherwise |
duke@1 | 195 | * |
duke@1 | 196 | */ |
duke@1 | 197 | public abstract boolean equivalent(TypeCode tc); |
duke@1 | 198 | |
duke@1 | 199 | /** |
duke@1 | 200 | * Strips out all optional name and member name fields, |
duke@1 | 201 | * but leaves all alias typecodes intact. |
duke@1 | 202 | * @return a <code>TypeCode</code> object with optional name and |
duke@1 | 203 | * member name fields stripped out, except for alias typecodes, |
duke@1 | 204 | * which are left intact |
duke@1 | 205 | * @see <a href="package-summary.html#unimpl"><code>CORBA</code> package |
duke@1 | 206 | * comments for unimplemented features</a> |
duke@1 | 207 | */ |
duke@1 | 208 | public abstract TypeCode get_compact_typecode(); |
duke@1 | 209 | |
duke@1 | 210 | |
duke@1 | 211 | /** |
duke@1 | 212 | * Retrieves the kind of this <code>TypeCode</code> object. |
duke@1 | 213 | * The kind of a type code determines which <code>TypeCode</code> |
duke@1 | 214 | * methods may legally be invoked on it. |
duke@1 | 215 | * <P> |
duke@1 | 216 | * The method <code>kind</code> may be invoked on any |
duke@1 | 217 | * <code>TypeCode</code> object. |
duke@1 | 218 | * |
duke@1 | 219 | * @return the <code>TCKind</code> instance indicating the |
duke@1 | 220 | * value of the <code>kind</code> field of this |
duke@1 | 221 | * <code>TypeCode</code> object |
duke@1 | 222 | */ |
duke@1 | 223 | |
duke@1 | 224 | public abstract TCKind kind(); |
duke@1 | 225 | |
duke@1 | 226 | /** |
duke@1 | 227 | * Retrieves the RepositoryId globally identifying the type |
duke@1 | 228 | * of this <code>TypeCode</code> object. |
duke@1 | 229 | * <P> |
duke@1 | 230 | * The method <code>id</code> can be invoked on object reference, |
duke@1 | 231 | * structure, union, enumeration, alias, exception, valuetype, |
duke@1 | 232 | * boxed valuetype, native, and abstract interface type codes. |
duke@1 | 233 | * Object reference, exception, valuetype, boxed valuetype, |
duke@1 | 234 | * native, and abstract interface <code>TypeCode</code> objects |
duke@1 | 235 | * always have a RepositoryId. |
duke@1 | 236 | * Structure, union, enumeration, and alias <code>TypeCode</code> objects |
duke@1 | 237 | * obtained from the Interface Repository or the method |
duke@1 | 238 | * <code>ORB.create_operation_list</code> |
duke@1 | 239 | * also always have a RepositoryId. If there is no RepositoryId, the |
duke@1 | 240 | * method can return an empty string. |
duke@1 | 241 | * |
duke@1 | 242 | * @return the RepositoryId for this <code>TypeCode</code> object |
duke@1 | 243 | * or an empty string if there is no RepositoryID |
duke@1 | 244 | * @throws org.omg.CORBA.TypeCodePackage.BadKind if the method |
duke@1 | 245 | * is invoked on an inappropriate kind of<code>TypeCode</code> |
duke@1 | 246 | * object |
duke@1 | 247 | */ |
duke@1 | 248 | |
duke@1 | 249 | public abstract String id() throws BadKind; |
duke@1 | 250 | |
duke@1 | 251 | /** |
duke@1 | 252 | * Retrieves the simple name identifying this <code>TypeCode</code> |
duke@1 | 253 | * object within its |
duke@1 | 254 | * enclosing scope. Since names are local to a Repository, the |
duke@1 | 255 | * name returned from a <code>TypeCode</code> object |
duke@1 | 256 | * may not match the name of the |
duke@1 | 257 | * type in any particular Repository, and may even be an empty |
duke@1 | 258 | * string. |
duke@1 | 259 | * <P> |
duke@1 | 260 | * The method <code>name</code> can be invoked on object reference, |
duke@1 | 261 | * structure, union, enumeration, alias, exception, valuetype, |
duke@1 | 262 | * boxed valuetype, native, and abstract interface |
duke@1 | 263 | * <code>TypeCode</code> objects. |
duke@1 | 264 | * |
duke@1 | 265 | * @return the name identifying this <code>TypeCode</code> object |
duke@1 | 266 | * or an empty string |
duke@1 | 267 | * @throws org.omg.CORBA.TypeCodePackage.BadKind if the method |
duke@1 | 268 | * is invoked on an inappropriate kind of<code>TypeCode</code> |
duke@1 | 269 | * object |
duke@1 | 270 | */ |
duke@1 | 271 | |
duke@1 | 272 | public abstract String name() throws BadKind; |
duke@1 | 273 | |
duke@1 | 274 | /** |
duke@1 | 275 | * Retrieves the number of members in the type described by |
duke@1 | 276 | * this <code>TypeCode</code> object. |
duke@1 | 277 | * <P> |
duke@1 | 278 | * The method <code>member_count</code> can be invoked on |
duke@1 | 279 | * structure, union, and enumeration <code>TypeCode</code> objects. |
duke@1 | 280 | * Java IDL extends the CORBA specification to allow this method to |
duke@1 | 281 | * operate on exceptions as well. |
duke@1 | 282 | * |
duke@1 | 283 | * @return the number of members constituting the type described |
duke@1 | 284 | * by this <code>TypeCode</code> object |
duke@1 | 285 | * |
duke@1 | 286 | * @throws org.omg.CORBA.TypeCodePackage.BadKind if the method |
duke@1 | 287 | * is invoked on an inappropriate kind of <code>TypeCode</code> |
duke@1 | 288 | * object |
duke@1 | 289 | */ |
duke@1 | 290 | |
duke@1 | 291 | public abstract int member_count() throws BadKind; |
duke@1 | 292 | |
duke@1 | 293 | /** |
duke@1 | 294 | * Retrieves the simple name of the member identified by |
duke@1 | 295 | * the given index. Since names are local to a |
duke@1 | 296 | * Repository, the name returned from a <code>TypeCode</code> object |
duke@1 | 297 | * may not match the name of the member in any particular |
duke@1 | 298 | * Repository, and may even be an empty string. |
duke@1 | 299 | * <P> |
duke@1 | 300 | * The method <code>member_name</code> can be invoked on structure, union, |
duke@1 | 301 | * and enumeration <code>TypeCode</code> objects. |
duke@1 | 302 | * Java IDL extends the CORBA specification to allow this method to |
duke@1 | 303 | * operate on exceptions as well. |
duke@1 | 304 | * |
duke@1 | 305 | * @param index index of the member for which a name is being reqested |
duke@1 | 306 | * @return simple name of the member identified by the |
duke@1 | 307 | * index or an empty string |
duke@1 | 308 | * @throws org.omg.CORBA.TypeCodePackage.Bounds if the index is equal |
duke@1 | 309 | * to or greater than |
duke@1 | 310 | * the number of members constituting the type |
duke@1 | 311 | * @throws org.omg.CORBA.TypeCodePackage.BadKind if the method |
duke@1 | 312 | * is invoked on an inappropriate kind of <code>TypeCode</code> |
duke@1 | 313 | * object |
duke@1 | 314 | */ |
duke@1 | 315 | |
duke@1 | 316 | public abstract String member_name(int index) |
duke@1 | 317 | throws BadKind, org.omg.CORBA.TypeCodePackage.Bounds; |
duke@1 | 318 | |
duke@1 | 319 | /** |
duke@1 | 320 | * Retrieves the <code>TypeCode</code> object describing the type |
duke@1 | 321 | * of the member identified by the given index. |
duke@1 | 322 | * <P> |
duke@1 | 323 | * The method <code>member_type</code> can be invoked on structure |
duke@1 | 324 | * and union <code>TypeCode</code> objects. |
duke@1 | 325 | * Java IDL extends the CORBA specification to allow this method to |
duke@1 | 326 | * operate on exceptions as well. |
duke@1 | 327 | * |
duke@1 | 328 | * @param index index of the member for which type information |
duke@1 | 329 | * is begin requested |
duke@1 | 330 | * @return the <code>TypeCode</code> object describing the |
duke@1 | 331 | * member at the given index |
duke@1 | 332 | * @throws org.omg.CORBA.TypeCodePackage.Bounds if the index is |
duke@1 | 333 | * equal to or greater than |
duke@1 | 334 | * the number of members constituting the type |
duke@1 | 335 | * @throws org.omg.CORBA.TypeCodePackage.BadKind if the method |
duke@1 | 336 | * is invoked on an inappropriate kind of <code>TypeCode</code> |
duke@1 | 337 | * object |
duke@1 | 338 | */ |
duke@1 | 339 | |
duke@1 | 340 | public abstract TypeCode member_type(int index) |
duke@1 | 341 | throws BadKind, org.omg.CORBA.TypeCodePackage.Bounds; |
duke@1 | 342 | |
duke@1 | 343 | /** |
duke@1 | 344 | * Retrieves the label of the union member |
duke@1 | 345 | * identified by the given index. For the default member, |
duke@1 | 346 | * the label is the zero octet. |
duke@1 | 347 | *<P> |
duke@1 | 348 | * The method <code>member_label</code> can only be invoked on union |
duke@1 | 349 | * <code>TypeCode</code> objects. |
duke@1 | 350 | * |
duke@1 | 351 | * @param index index of the union member for which the |
duke@1 | 352 | * label is being requested |
duke@1 | 353 | * @return an <code>Any</code> object describing the label of |
duke@1 | 354 | * the requested union member or the zero octet for |
duke@1 | 355 | * the default member |
duke@1 | 356 | * @throws org.omg.CORBA.TypeCodePackage.Bounds if the index is |
duke@1 | 357 | * equal to or greater than |
duke@1 | 358 | * the number of members constituting the union |
duke@1 | 359 | * @throws org.omg.CORBA.TypeCodePackage.BadKind if the method |
duke@1 | 360 | * is invoked on a non-union <code>TypeCode</code> |
duke@1 | 361 | * object |
duke@1 | 362 | */ |
duke@1 | 363 | |
duke@1 | 364 | public abstract Any member_label(int index) |
duke@1 | 365 | throws BadKind, org.omg.CORBA.TypeCodePackage.Bounds; |
duke@1 | 366 | |
duke@1 | 367 | /** |
duke@1 | 368 | * Returns a <code>TypeCode</code> object describing |
duke@1 | 369 | * all non-default member labels. |
duke@1 | 370 | * The method <code>discriminator_type</code> can be invoked only |
duke@1 | 371 | * on union <code>TypeCode</code> objects. |
duke@1 | 372 | * |
duke@1 | 373 | * @return the <code>TypeCode</code> object describing |
duke@1 | 374 | * the non-default member labels |
duke@1 | 375 | * @throws org.omg.CORBA.TypeCodePackage.BadKind if the method |
duke@1 | 376 | * is invoked on a non-union <code>TypeCode</code> |
duke@1 | 377 | * object |
duke@1 | 378 | */ |
duke@1 | 379 | |
duke@1 | 380 | public abstract TypeCode discriminator_type() |
duke@1 | 381 | throws BadKind; |
duke@1 | 382 | |
duke@1 | 383 | /** |
duke@1 | 384 | * Returns the index of the |
duke@1 | 385 | * default member, or -1 if there is no default member. |
duke@1 | 386 | * <P> |
duke@1 | 387 | * The method <code>default_index</code> can be invoked only on union |
duke@1 | 388 | * <code>TypeCode</code> objects. |
duke@1 | 389 | * |
duke@1 | 390 | * @return the index of the default member, or -1 if |
duke@1 | 391 | * there is no default member |
duke@1 | 392 | * @throws org.omg.CORBA.TypeCodePackage.BadKind if the method |
duke@1 | 393 | * is invoked on a non-union <code>TypeCode</code> |
duke@1 | 394 | * object |
duke@1 | 395 | */ |
duke@1 | 396 | |
duke@1 | 397 | public abstract int default_index() throws BadKind; |
duke@1 | 398 | |
duke@1 | 399 | /** |
duke@1 | 400 | * Returns the number of elements in the type described by |
duke@1 | 401 | * this <code>TypeCode</code> object. |
duke@1 | 402 | * For strings and sequences, it returns the |
duke@1 | 403 | * bound, with zero indicating an unbounded string or sequence. |
duke@1 | 404 | * For arrays, it returns the number of elements in the array. |
duke@1 | 405 | * <P> |
duke@1 | 406 | * The method <code>length</code> can be invoked on string, sequence, and |
duke@1 | 407 | * array <code>TypeCode</code> objects. |
duke@1 | 408 | * |
duke@1 | 409 | * @return the bound for strings and sequences, or the |
duke@1 | 410 | * number of elements for arrays |
duke@1 | 411 | * @throws org.omg.CORBA.TypeCodePackage.BadKind if the method |
duke@1 | 412 | * is invoked on an inappropriate kind of <code>TypeCode</code> |
duke@1 | 413 | * object |
duke@1 | 414 | */ |
duke@1 | 415 | |
duke@1 | 416 | public abstract int length() throws BadKind; |
duke@1 | 417 | |
duke@1 | 418 | /** |
duke@1 | 419 | * Returns the <code>TypeCode</code> object representing the |
duke@1 | 420 | * IDL type for the members of the object described by this |
duke@1 | 421 | * <code>TypeCode</code> object. |
duke@1 | 422 | * For sequences and arrays, it returns the |
duke@1 | 423 | * element type. For aliases, it returns the original type. Note |
duke@1 | 424 | * that multidimensional arrays are represented by nesting |
duke@1 | 425 | * <code>TypeCode</code> objects, one per dimension. |
duke@1 | 426 | * For boxed valuetypes, it returns the boxed type. |
duke@1 | 427 | *<P> |
duke@1 | 428 | * The method <code>content_type</code> can be invoked on sequence, array, |
duke@1 | 429 | * alias, and boxed valuetype <code>TypeCode</code> objects. |
duke@1 | 430 | * |
duke@1 | 431 | * @return a <code>TypeCode</code> object representing |
duke@1 | 432 | * the element type for sequences and arrays, the |
duke@1 | 433 | * original type for aliases, or the |
duke@1 | 434 | * boxed type for boxed valuetypes. |
duke@1 | 435 | * @throws org.omg.CORBA.TypeCodePackage.BadKind if the method |
duke@1 | 436 | * is invoked on an inappropriate kind of <code>TypeCode</code> |
duke@1 | 437 | * object |
duke@1 | 438 | */ |
duke@1 | 439 | |
duke@1 | 440 | public abstract TypeCode content_type() throws BadKind; |
duke@1 | 441 | |
duke@1 | 442 | |
duke@1 | 443 | /** |
duke@1 | 444 | * Returns the number of digits in the fixed type described by this |
duke@1 | 445 | * <code>TypeCode</code> object. For example, the typecode for |
duke@1 | 446 | * the number 3000.275d could be <code>fixed<7,3></code>, where |
duke@1 | 447 | * 7 is the precision and 3 is the scale. |
duke@1 | 448 | * |
duke@1 | 449 | * @return the total number of digits |
duke@1 | 450 | * @throws org.omg.CORBA.TypeCodePackage.BadKind if this method |
duke@1 | 451 | * is invoked on an inappropriate kind of <code>TypeCode</code> |
duke@1 | 452 | * object |
duke@1 | 453 | * |
duke@1 | 454 | */ |
duke@1 | 455 | public abstract short fixed_digits() throws BadKind ; |
duke@1 | 456 | |
duke@1 | 457 | /** |
duke@1 | 458 | * Returns the scale of the fixed type described by this |
duke@1 | 459 | * <code>TypeCode</code> object. A positive number indicates the |
duke@1 | 460 | * number of digits to the right of the decimal point. |
duke@1 | 461 | * For example, the number 3000d could have the |
duke@1 | 462 | * typecode <code>fixed<4,0></code>, where the first number is |
duke@1 | 463 | * the precision and the second number is the scale. |
duke@1 | 464 | * A negative number is also possible and adds zeroes to the |
duke@1 | 465 | * left of the decimal point. In this case, <code>fixed<1,-3></code>, |
duke@1 | 466 | * could be the typecode for the number 3000d. |
duke@1 | 467 | * |
duke@1 | 468 | * @return the scale of the fixed type that this |
duke@1 | 469 | * <code>TypeCode</code> object describes |
duke@1 | 470 | * @throws org.omg.CORBA.TypeCodePackage.BadKind if this method |
duke@1 | 471 | * is invoked on an inappropriate kind of <code>TypeCode</code> |
duke@1 | 472 | * object |
duke@1 | 473 | */ |
duke@1 | 474 | public abstract short fixed_scale() throws BadKind ; |
duke@1 | 475 | |
duke@1 | 476 | /** |
duke@1 | 477 | * Returns the constant that indicates the visibility of the member |
duke@1 | 478 | * at the given index. |
duke@1 | 479 | * |
duke@1 | 480 | * This operation can only be invoked on non-boxed value |
duke@1 | 481 | * <code>TypeCode</code> objects. |
duke@1 | 482 | * |
duke@1 | 483 | * @param index an <code>int</code> indicating the index into the |
duke@1 | 484 | * value |
duke@1 | 485 | * @return either <code>PRIVATE_MEMBER.value</code> or |
duke@1 | 486 | * <code>PUBLIC_MEMBER.value</code> |
duke@1 | 487 | * @throws org.omg.CORBA.TypeCodePackage.BadKind if this method |
duke@1 | 488 | * is invoked on a non-value type <code>TypeCode</code> |
duke@1 | 489 | * object |
duke@1 | 490 | * @throws org.omg.CORBA.TypeCodePackage.Bounds |
duke@1 | 491 | * if the given index is out of bounds |
duke@1 | 492 | * @see <a href="package-summary.html#unimpl"><code>CORBA</code> package |
duke@1 | 493 | * comments for unimplemented features</a> |
duke@1 | 494 | */ |
duke@1 | 495 | |
duke@1 | 496 | abstract public short member_visibility(int index) |
duke@1 | 497 | throws BadKind, org.omg.CORBA.TypeCodePackage.Bounds ; |
duke@1 | 498 | |
duke@1 | 499 | /** |
duke@1 | 500 | * Returns a constant indicating the modifier of the value type |
duke@1 | 501 | * that this <code>TypeCode</code> object describes. The constant |
duke@1 | 502 | * returned must be one of the following: <code>VM_NONE.value</code>, |
duke@1 | 503 | * <code>VM_ABSTRACT.value</code>, <code>VM_CUSTOM.value</code>, |
duke@1 | 504 | * or <code>VM_TRUNCATABLE.value</code>, |
duke@1 | 505 | * |
duke@1 | 506 | * @return a constant describing the value type |
duke@1 | 507 | * that this <code>TypeCode</code> object describes |
duke@1 | 508 | * @throws org.omg.CORBA.TypeCodePackage.BadKind |
duke@1 | 509 | * if this method |
duke@1 | 510 | * is invoked on a non-value type <code>TypeCode</code> |
duke@1 | 511 | * object |
duke@1 | 512 | * @see <a href="package-summary.html#unimpl"><code>CORBA</code> package |
duke@1 | 513 | * comments for unimplemented features</a> |
duke@1 | 514 | */ |
duke@1 | 515 | |
duke@1 | 516 | abstract public short type_modifier() throws BadKind ; |
duke@1 | 517 | |
duke@1 | 518 | /** |
duke@1 | 519 | * Returns the <code>TypeCode</code> object that describes the concrete base type |
duke@1 | 520 | * of the value type that this <code>TypeCode</code> object describes. |
duke@1 | 521 | * Returns null if it doesn't have a concrete base type. |
duke@1 | 522 | * |
duke@1 | 523 | * @return the <code>TypeCode</code> object that describes the |
duke@1 | 524 | * concrete base type of the value type |
duke@1 | 525 | * that this <code>TypeCode</code> object describes |
duke@1 | 526 | * @throws org.omg.CORBA.TypeCodePackage.BadKind if this method |
duke@1 | 527 | * is invoked on a non-boxed value type <code>TypeCode</code> object |
duke@1 | 528 | * @see <a href="package-summary.html#unimpl"><code>CORBA</code> package |
duke@1 | 529 | * comments for unimplemented features</a> |
duke@1 | 530 | */ |
duke@1 | 531 | |
duke@1 | 532 | abstract public TypeCode concrete_base_type() throws BadKind ; |
duke@1 | 533 | } |