Source for org.omg.CORBA.TypeCode

   1: /* TypeCode.java --
   2:    Copyright (C) 2005 Free Software Foundation, Inc.
   3: 
   4: This file is part of GNU Classpath.
   5: 
   6: GNU Classpath is free software; you can redistribute it and/or modify
   7: it under the terms of the GNU General Public License as published by
   8: the Free Software Foundation; either version 2, or (at your option)
   9: any later version.
  10: 
  11: GNU Classpath is distributed in the hope that it will be useful, but
  12: WITHOUT ANY WARRANTY; without even the implied warranty of
  13: MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  14: General Public License for more details.
  15: 
  16: You should have received a copy of the GNU General Public License
  17: along with GNU Classpath; see the file COPYING.  If not, write to the
  18: Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
  19: 02110-1301 USA.
  20: 
  21: Linking this library statically or dynamically with other modules is
  22: making a combined work based on this library.  Thus, the terms and
  23: conditions of the GNU General Public License cover the whole
  24: combination.
  25: 
  26: As a special exception, the copyright holders of this library give you
  27: permission to link this library with independent modules to produce an
  28: executable, regardless of the license terms of these independent
  29: modules, and to copy and distribute the resulting executable under
  30: terms of your choice, provided that you also meet, for each linked
  31: independent module, the terms and conditions of the license of that
  32: module.  An independent module is a module which is not derived from
  33: or based on this library.  If you modify this library, you may extend
  34: this exception to your version of the library, but you are not
  35: obligated to do so.  If you do not wish to do so, delete this
  36: exception statement from your version. */
  37: 
  38: 
  39: package org.omg.CORBA;
  40: 
  41: import java.io.Serializable;
  42: 
  43: import org.omg.CORBA.TypeCodePackage.BadKind;
  44: import org.omg.CORBA.portable.IDLEntity;
  45: 
  46: /**
  47:  * An information about a CORBA data type.
  48:  * @author Audrius Meskauskas (AudriusA@Bioinformatics.org)
  49:  */
  50: public abstract class TypeCode
  51:   implements IDLEntity, Serializable
  52: {
  53:   /**
  54:    * Use serialVersionUID for interoperability.
  55:    * Using the version 1.4 UID.
  56:    */
  57:   private static final long serialVersionUID = -6521025782489515676L;
  58: 
  59:   /**
  60:    * Returns the concrete base type for this TypeCode.
  61:    * @return a TypeCode, defining the concrete base type for this
  62:    * Typecode.
  63:    * @throws org.omg.CORBA.TypeCodePackage.BadKind
  64:    */
  65:   public abstract TypeCode concrete_base_type()
  66:                                        throws BadKind;
  67: 
  68:   /**
  69:    * For sequences, arrays, aliases and value boxes, returns the IDL type for
  70:    * the members of the object.
  71:    * @return a TypeCode of the memebers of this type.
  72:    * @throws org.omg.CORBA.TypeCodePackage.BadKind for types other than
  73:    * sequences, arrays, aliases and value boxes.
  74:    */
  75:   public abstract TypeCode content_type()
  76:                                  throws BadKind;
  77: 
  78:   /**
  79:    * For unions, returs the index of the default member.
  80:    * @return the index of the default member, -1 if there is
  81:    * no default member.
  82:    * @throws org.omg.CORBA.TypeCodePackage.BadKind if this type is not
  83:    * a union.
  84:    */
  85:   public abstract int default_index()
  86:                              throws BadKind;
  87: 
  88:   /**
  89:    * Returs definition of member labels for untions
  90:    * @return a TypeCode, describing all non-default member labels.
  91:    * @throws org.omg.CORBA.TypeCodePackage.BadKind if this type is not a
  92:    * union.
  93:    */
  94:   public abstract TypeCode discriminator_type()
  95:                                        throws BadKind;
  96: 
  97:   /**
  98:    * Test two types for equality. The default implementation
  99:    * returs true of the types of the same kind.
 100:    * @param other the other type to compere with
 101:    * @return true if the types are interchangeable.
 102:    */
 103:   public abstract boolean equal(TypeCode other);
 104: 
 105:   /**
 106:    * Following the current 1.4 API specifcation, this should just throw
 107:    * NO_IMPLEMENT.
 108:    * @throws org.omg.CORBA.NO_IMPLEMENT, always.
 109:    */
 110:   public abstract boolean equivalent(TypeCode other);
 111: 
 112:   /**
 113:    * For the fixed type, returns the number of digits.
 114:    * @return the number of digits for the fixed type
 115:    * @throws org.omg.CORBA.TypeCodePackage.BadKind if this is not a fixed
 116:    * type.
 117:    */
 118:   public abstract short fixed_digits()
 119:                               throws BadKind;
 120: 
 121:   /**
 122:    * Returns the scale for the fixed type. The returned value can be either
 123:    * positive (the number of digits to the right of the decimal point) or
 124:    * negative (adds zeros to the left of the decimal point).
 125:    * @return the scale.
 126:    * @throws org.omg.CORBA.TypeCodePackage.BadKind if this is not a fixed
 127:    * type.
 128:    */
 129:   public abstract short fixed_scale()
 130:                              throws BadKind;
 131: 
 132:   /**
 133:    * Returns a version of this instance without the optional memeber and
 134:    * member name fields.
 135:    * @return the truncated version.
 136:    */
 137:   public abstract TypeCode get_compact_typecode();
 138: 
 139:   /**
 140:    * Returns the RepositoryId globally identifying the type, defined by
 141:    * this TypeCode.
 142:    * @return tje RepositoryId. In some cases, it may be an empty string.
 143:    * @throws org.omg.CORBA.TypeCodePackage.BadKind if the type is other than
 144:    * reference, structure, union, enumeration, alias, exception, valuetype,
 145:    * boxed valuetype and also native and abstract interfaces.
 146:    */
 147:   public abstract String id()
 148:                      throws BadKind;
 149: 
 150:   /**
 151:    * Return the kind of this type code object.
 152:    * @return one of the <code>TCKind.t_..</code> fields.
 153:    */
 154:   public abstract TCKind kind();
 155: 
 156:   /**
 157:    * Returns the number of elements in the type. For arrays, this
 158:    * method returns the length of the array. For strings and sequences,
 159:    * it returns the bound of the type, zero indicating the unbounded
 160:    * type.
 161:    *
 162:    * @return length or bound
 163:    *
 164:    * @throws org.omg.CORBA.TypeCodePackage.BadKind for types other than
 165:    * string, sequence and array.
 166:    */
 167:   public abstract int length()
 168:                       throws BadKind;
 169: 
 170:   /**
 171:    * Returns the number of type memebers.
 172:    *
 173:    * @return the number of memebers
 174:    * @throws org.omg.CORBA.TypeCodePackage.BadKind for types other than
 175:    * structure, union, enumeration or exception.
 176:    */
 177:   public abstract int member_count()
 178:                             throws BadKind;
 179: 
 180:   /**
 181:    * Retrieves the label of the union member at the given index.
 182:    * For the default member, this label is the zero octet.
 183:    *
 184:    * @param index the index of the union memeber.
 185:    *
 186:    * @return the label
 187:    *
 188:    * @throws org.omg.CORBA.TypeCodePackage.BadKind if this is not a union
 189:    * type.
 190:    * @throws org.omg.CORBA.TypeCodePackage.Bounds if the index is out of
 191:    * valid bounds.
 192:    */
 193:   public abstract Any member_label(int index)
 194:     throws BadKind, 
 195:        org.omg.CORBA.TypeCodePackage.Bounds;
 196: 
 197:   /**
 198:    * Retrieves the simple name of the member identified by the given index.
 199:    *
 200:    * @param index the index of the memeber.
 201:    *
 202:    * @return the member name that in some cases can be an empty string.
 203:    *
 204:    * @throws org.omg.CORBA.TypeCodePackage.BadKind for types other than
 205:    * structure, union or enumeration.
 206:    * @throws org.omg.CORBA.TypeCodePackage.Bounds if the index is out of
 207:    * valid bounds.
 208:    */
 209:   public abstract String member_name(int index)
 210:     throws BadKind, 
 211:        org.omg.CORBA.TypeCodePackage.Bounds;
 212: 
 213:   /**
 214:    * Retrieves the member type of the member identified by the given index.
 215:    *
 216:    * @param index the index of the memeber.
 217:    *
 218:    * @return the member type.
 219:    *
 220:    * @throws org.omg.CORBA.TypeCodePackage.BadKind for types other than
 221:    * structure, union, enumeration or exception.
 222:    * @throws org.omg.CORBA.TypeCodePackage.Bounds if the index is out of
 223:    * valid bounds.
 224:    */
 225:   public abstract TypeCode member_type(int index)
 226:     throws BadKind,
 227:        org.omg.CORBA.TypeCodePackage.Bounds;
 228: 
 229:   /**
 230:    * Returns the visibility scope of the member at the given index.
 231:    * This operation can only be invoked on non-boxed value types.
 232:    *
 233:    * @param index the index of the member
 234:    *
 235:    * @return either PRIVATE_MEMBER.value or PUBLIC_MEMBER.value
 236:    *
 237:    * @throws org.omg.CORBA.TypeCodePackage.BadKind if this is not a non boxed
 238:    * value type.
 239:    *
 240:    * @throws org.omg.CORBA.TypeCodePackage.Bounds if the index is out of
 241:    * valid bounds.
 242:    */
 243:   public abstract short member_visibility(int index)
 244:     throws BadKind,
 245:        org.omg.CORBA.TypeCodePackage.Bounds;
 246: 
 247: 
 248:   /**
 249:    * Retrieves the simple name identifying this TypeCode object
 250:    * within its enclosing scope.
 251:    * @return the name, can be an empty string.
 252:    * @throws org.omg.CORBA.TypeCodePackage.BadKind for typer other than
 253:    * reference, structure, union, enumeration, alias, exception,
 254:    * valuetype, boxed valuetype, native, and abstract interface
 255:    */
 256:   public abstract String name()
 257:                        throws BadKind;
 258: 
 259:   /**
 260:    * Returns a constant indicating the modifier of the value type.
 261:    *
 262:    * @return one of the following constants:
 263:    * VM_NONE.value, VM_ABSTRACT.value, VM_CUSTOM.value, or
 264:    * VM_TRUNCATABLE.value,
 265:    *
 266:    * @throws org.omg.CORBA.TypeCodePackage.BadKind for types other than
 267:    * value type.
 268:    */
 269:   public abstract short type_modifier()
 270:                                throws BadKind;
 271: }