All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.omg.CORBA.TypeCode Maven / Gradle / Ivy

/*
 * Copyright (c) 1997, 2020 Oracle and/or its affiliates.
 *
 * This program and the accompanying materials are made available under the
 * terms of the Eclipse Public License v. 2.0 which is available at
 * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License
 * v. 1.0 which is available at
 * http://www.eclipse.org/org/documents/edl-v10.php.
 *
 * This Source Code may also be made available under the following Secondary
 * Licenses when the conditions for such availability set forth in the Eclipse
 * Public License v. 2.0 are satisfied: GNU General Public License v2.0
 * w/Classpath exception which is available at
 * https://www.gnu.org/software/classpath/license.html.
 *
 * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause OR GPL-2.0 WITH
 * Classpath-exception-2.0
 */

package org.omg.CORBA;

import org.omg.CORBA.TypeCodePackage.*;
import org.omg.CORBA.portable.IDLEntity;

/**
 * A container for information about a specific CORBA data
 * type.
 *

* TypeCode objects are used: *

    *
  • in the Dynamic Invocation Interface -- to indicate the types * of the actual arguments or the type of the return value.
    * NamedValue objects are used to represent arguments and * return values. One of their components is an Any * object, which in turn has as one of its components a * TypeCode object. *
  • by an Interface Repository to represent the type specifications * that are part of many OMG IDL declarations *
*

* The representation of a TypeCode object is opaque, * but abstractly, a TypeCode object consists of: *

    *
  • a kind field, which is set to an instance * of the class TCKind *
  • zero or more additional fields appropriate * for the particular kind. For example, the * TypeCode object * describing the OMG IDL type 1ong has kind * TCKind.tk_long and no additional fields. * The TypeCode describing OMG IDL type * sequence<boolean, 10> has a kind field * with the value * TCKind.tk_sequence and also fields with the values * boolean and 10 for the * type of sequence elements and the length of the sequence.

    *

* * TypeCode objects can be obtained in various ways: *
    *
  1. from a call to the method Any.insert_X, where X is * a basic IDL type. This method creates a TypeCode object * for type X and assigns it to the Any object's * type field. *
  2. from invocations of methods in the ORB class *

    For example, the following creates a TypeCode * object for a string with a maximum of 30 characters: *

     *   org.omg.CORBA.TypeCode tcString = orb.create_string_tc(30);
     * 
    *

    The following creates a TypeCode * object for an array of five strings: *

     *   org.omg.CORBA.TypeCode tcArray = orb.create_array_tc(
     *                                       5, TCKind.tk_string);
     * 
    *

    The following creates a TypeCode * object for an interface named "Account": *

     *   org.omg.CORBA.TypeCode tcInterface = orb.create_interface_tc(
     *                                                 "thisId", "Account");
     * 
    *
  3. as the return value from the _type method * in Holder classes for user-defined * IDL types. These Holder classes are generated * by the idltojava compiler. *
  4. from a CORBA Interface Repository *
*

* Most of the methods in the class TypeCode * are accessors, and the information contained in a TypeCode * object is specific to a particular type. Therefore, methods * must be invoked * only on the kind of type codes to which they apply. If an * accessor method * tries to access information from an inappropriate kind of * type code, it will throw * the exception TypeCodePackage.BadKind. For example, * if the method discriminator_type is called on anything * other than a union, it will throw BadKind * because only unions have a discriminator. * The following list shows which methods apply to which kinds of * type codes: *

* These methods may be invoked on all TypeCode kinds: *

    *
  • equal *
  • kind *
*

* These methods may be invoked on objref, struct, * union, enum, * alias, exception, value, * value_box, native, * and abstract_interface: *

    *
  • id *
  • name *
*

* These methods may be invoked on struct, * union, enum, * and exception: *

    *
  • member_count *
  • member_name *
*

* These methods may be invoked on struct, * union, and exception: *

    *
  • member_type(int index) *
*

* These methods may be invoked on union: *

    *
  • member_label *
  • discriminator_type *
  • default_index *
*

* These methods may be invoked on string, * sequence, and array: *

    *
  • length *
*

* These methods may be invoked on alias, * sequence, array, and value_box: *

    *
  • content_type *
*

* Unlike other CORBA pseudo-objects, TypeCode * objects can be passed as general IDL parameters.

* The methods parameter and param_count, * which are deprecated, are not mapped.

* * Java IDL extends the CORBA specification to allow all operations permitted * on a struct TypeCode to be permitted * on an exception TypeCode as well.

* * @version 1.25 09/09/97 */ public abstract class TypeCode implements IDLEntity { /** * Compares this TypeCode object with the given one, * testing for equality. TypeCode objects are equal if * they are interchangeable and give identical results when * TypeCode operations are applied to them. * * @param tc the TypeCode object to compare against * @return true if the type codes are equal; * false otherwise */ public abstract boolean equal(TypeCode tc); /** * Tests to see if the given TypeCode object is * equivalent to this TypeCode object. *

* Not implemented; see package comments. * * @param tc the typecode to compare with this typecode * * @return true if the given typecode is equivalent to * this typecode; false otherwise * @see CORBA package * comments for unimplemented features */ public abstract boolean equivalent(TypeCode tc); /** * Strips out all optional name and member name fields, * but leaves all alias typecodes intact. * @return a TypeCode object with optional name and * member name fields stripped out, except for alias typecodes, * which are left intact * @see CORBA package * comments for unimplemented features */ public abstract TypeCode get_compact_typecode(); /** * Retrieves the kind of this TypeCode object. * The kind of a type code determines which TypeCode * methods may legally be invoked on it. *

* The method kind may be invoked on any * TypeCode object. * * @return the TCKind instance indicating the * value of the kind field of this * TypeCode object */ public abstract TCKind kind(); /** * Retrieves the RepositoryId globally identifying the type * of this TypeCode object. *

* The method id can be invoked on object reference, * structure, union, enumeration, alias, exception, valuetype, * boxed valuetype, native, and abstract interface type codes. * Object reference, exception, valuetype, boxed valuetype, * native, and abstract interface TypeCode objects * always have a RepositoryId. * Structure, union, enumeration, and alias TypeCode objects * obtained from the Interface Repository or the method * ORB.create_operation_list * also always have a RepositoryId. If there is no RepositoryId, the * method can return an empty string. * * @return the RepositoryId for this TypeCode object * or an empty string if there is no RepositoryID * @throws org.omg.CORBA.TypeCodePackage.BadKind if the method * is invoked on an inappropriate kind ofTypeCode * object */ public abstract String id() throws BadKind; /** * Retrieves the simple name identifying this TypeCode * object within its * enclosing scope. Since names are local to a Repository, the * name returned from a TypeCode object * may not match the name of the * type in any particular Repository, and may even be an empty * string. *

* The method name can be invoked on object reference, * structure, union, enumeration, alias, exception, valuetype, * boxed valuetype, native, and abstract interface * TypeCode objects. * * @return the name identifying this TypeCode object * or an empty string * @throws org.omg.CORBA.TypeCodePackage.BadKind if the method * is invoked on an inappropriate kind ofTypeCode * object */ public abstract String name() throws BadKind; /** * Retrieves the number of members in the type described by * this TypeCode object. *

* The method member_count can be invoked on * structure, union, and enumeration TypeCode objects. * Java IDL extends the CORBA specification to allow this method to * operate on exceptions as well. * * @return the number of members constituting the type described * by this TypeCode object * * @throws org.omg.CORBA.TypeCodePackage.BadKind if the method * is invoked on an inappropriate kind of TypeCode * object */ public abstract int member_count() throws BadKind; /** * Retrieves the simple name of the member identified by * the given index. Since names are local to a * Repository, the name returned from a TypeCode object * may not match the name of the member in any particular * Repository, and may even be an empty string. *

* The method member_name can be invoked on structure, union, * and enumeration TypeCode objects. * Java IDL extends the CORBA specification to allow this method to * operate on exceptions as well. * * @param index index of the member for which a name is being reqested * @return simple name of the member identified by the * index or an empty string * @throws org.omg.CORBA.TypeCodePackage.Bounds if the index is equal * to or greater than * the number of members constituting the type * @throws org.omg.CORBA.TypeCodePackage.BadKind if the method * is invoked on an inappropriate kind of TypeCode * object */ public abstract String member_name(int index) throws BadKind, org.omg.CORBA.TypeCodePackage.Bounds; /** * Retrieves the TypeCode object describing the type * of the member identified by the given index. *

* The method member_type can be invoked on structure * and union TypeCode objects. * Java IDL extends the CORBA specification to allow this method to * operate on exceptions as well. * * @param index index of the member for which type information * is begin requested * @return the TypeCode object describing the * member at the given index * @throws org.omg.CORBA.TypeCodePackage.Bounds if the index is * equal to or greater than * the number of members constituting the type * @throws org.omg.CORBA.TypeCodePackage.BadKind if the method * is invoked on an inappropriate kind of TypeCode * object */ public abstract TypeCode member_type(int index) throws BadKind, org.omg.CORBA.TypeCodePackage.Bounds; /** * Retrieves the label of the union member * identified by the given index. For the default member, * the label is the zero octet. *

* The method member_label can only be invoked on union * TypeCode objects. * * @param index index of the union member for which the * label is being requested * @return an Any object describing the label of * the requested union member or the zero octet for * the default member * @throws org.omg.CORBA.TypeCodePackage.Bounds if the index is * equal to or greater than * the number of members constituting the union * @throws org.omg.CORBA.TypeCodePackage.BadKind if the method * is invoked on a non-union TypeCode * object */ public abstract Any member_label(int index) throws BadKind, org.omg.CORBA.TypeCodePackage.Bounds; /** * Returns a TypeCode object describing * all non-default member labels. * The method discriminator_type can be invoked only * on union TypeCode objects. * * @return the TypeCode object describing * the non-default member labels * @throws org.omg.CORBA.TypeCodePackage.BadKind if the method * is invoked on a non-union TypeCode * object */ public abstract TypeCode discriminator_type() throws BadKind; /** * Returns the index of the * default member, or -1 if there is no default member. *

* The method default_index can be invoked only on union * TypeCode objects. * * @return the index of the default member, or -1 if * there is no default member * @throws org.omg.CORBA.TypeCodePackage.BadKind if the method * is invoked on a non-union TypeCode * object */ public abstract int default_index() throws BadKind; /** * Returns the number of elements in the type described by * this TypeCode object. * For strings and sequences, it returns the * bound, with zero indicating an unbounded string or sequence. * For arrays, it returns the number of elements in the array. *

* The method length can be invoked on string, sequence, and * array TypeCode objects. * * @return the bound for strings and sequences, or the * number of elements for arrays * @throws org.omg.CORBA.TypeCodePackage.BadKind if the method * is invoked on an inappropriate kind of TypeCode * object */ public abstract int length() throws BadKind; /** * Returns the TypeCode object representing the * IDL type for the members of the object described by this * TypeCode object. * For sequences and arrays, it returns the * element type. For aliases, it returns the original type. Note * that multidimensional arrays are represented by nesting * TypeCode objects, one per dimension. * For boxed valuetypes, it returns the boxed type. *

* The method content_type can be invoked on sequence, array, * alias, and boxed valuetype TypeCode objects. * * @return a TypeCode object representing * the element type for sequences and arrays, the * original type for aliases, or the * boxed type for boxed valuetypes. * @throws org.omg.CORBA.TypeCodePackage.BadKind if the method * is invoked on an inappropriate kind of TypeCode * object */ public abstract TypeCode content_type() throws BadKind; /** * Returns the number of digits in the fixed type described by this * TypeCode object. For example, the typecode for * the number 3000.275d could be fixed<7,3>, where * 7 is the precision and 3 is the scale. * * @return the total number of digits * @throws org.omg.CORBA.TypeCodePackage.BadKind if this method * is invoked on an inappropriate kind of TypeCode * object * */ public abstract short fixed_digits() throws BadKind ; /** * Returns the scale of the fixed type described by this * TypeCode object. A positive number indicates the * number of digits to the right of the decimal point. * For example, the number 3000d could have the * typecode fixed<4,0>, where the first number is * the precision and the second number is the scale. * A negative number is also possible and adds zeroes to the * left of the decimal point. In this case, fixed<1,-3>, * could be the typecode for the number 3000d. * * @return the scale of the fixed type that this * TypeCode object describes * @throws org.omg.CORBA.TypeCodePackage.BadKind if this method * is invoked on an inappropriate kind of TypeCode * object */ public abstract short fixed_scale() throws BadKind ; /** * Returns the constant that indicates the visibility of the member * at the given index. * * This operation can only be invoked on non-boxed value * TypeCode objects. * * @param index an int indicating the index into the * value * @return either PRIVATE_MEMBER.value or * PUBLIC_MEMBER.value * @throws org.omg.CORBA.TypeCodePackage.BadKind if this method * is invoked on a non-value type TypeCode * object * @throws org.omg.CORBA.TypeCodePackage.Bounds * if the given index is out of bounds * @see CORBA package * comments for unimplemented features */ abstract public short member_visibility(int index) throws BadKind, org.omg.CORBA.TypeCodePackage.Bounds ; /** * Returns a constant indicating the modifier of the value type * that this TypeCode object describes. The constant * returned must be one of the following: VM_NONE.value, * VM_ABSTRACT.value, VM_CUSTOM.value, * or VM_TRUNCATABLE.value, * * @return a constant describing the value type * that this TypeCode object describes * @throws org.omg.CORBA.TypeCodePackage.BadKind * if this method * is invoked on a non-value type TypeCode * object * @see CORBA package * comments for unimplemented features */ abstract public short type_modifier() throws BadKind ; /** * Returns the TypeCode object that describes the concrete base type * of the value type that this TypeCode object describes. * Returns null if it doesn't have a concrete base type. * * @return the TypeCode object that describes the * concrete base type of the value type * that this TypeCode object describes * @throws org.omg.CORBA.TypeCodePackage.BadKind if this method * is invoked on a non-boxed value type TypeCode object * @see CORBA package * comments for unimplemented features */ abstract public TypeCode concrete_base_type() throws BadKind ; }





© 2015 - 2024 Weber Informatics LLC | Privacy Policy