1 /* PrimitiveTypeCode.java --
2 Copyright (C) 2005 Free Software Foundation, Inc.
4 Copyright (C) 2005 Free Software Foundation, Inc.
6 This file is part of GNU Classpath.
8 GNU Classpath is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 2, or (at your option)
13 GNU Classpath is distributed in the hope that it will be useful, but
14 WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 General Public License for more details.
18 You should have received a copy of the GNU General Public License
19 along with GNU Classpath; see the file COPYING. If not, write to the
20 Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
23 Linking this library statically or dynamically with other modules is
24 making a combined work based on this library. Thus, the terms and
25 conditions of the GNU General Public License cover the whole
28 As a special exception, the copyright holders of this library give you
29 permission to link this library with independent modules to produce an
30 executable, regardless of the license terms of these independent
31 modules, and to copy and distribute the resulting executable under
32 terms of your choice, provided that you also meet, for each linked
33 independent module, the terms and conditions of the license of that
34 module. An independent module is a module which is not derived from
35 or based on this library. If you modify this library, you may extend
36 this exception to your version of the library, but you are not
37 obligated to do so. If you do not wish to do so, delete this
38 exception statement from your version. */
40 package gnu.CORBA.typecodes;
42 import java.io.Serializable;
44 import org.omg.CORBA.Any;
45 import org.omg.CORBA.NO_IMPLEMENT;
46 import org.omg.CORBA.TCKind;
47 import org.omg.CORBA.TypeCode;
48 import org.omg.CORBA.TypeCodePackage.BadKind;
49 import org.omg.CORBA.TypeCodePackage.Bounds;
50 import org.omg.CORBA.portable.IDLEntity;
53 * An information about a primitive CORBA data type
54 * (boolean, char, wchar, octet and also signed or unsigned short, long,
55 * long long, float and double).
56 * This class only implements the methods {@link #kind() }
57 * and {@link equal() } that are valid for
58 * all TypeCode kinds. Other methods are implemented in derived
61 * @author Audrius Meskauskas (AudriusA@Bioinformatics.org)
63 public class PrimitiveTypeCode
65 implements IDLEntity, Serializable
68 * Use serialVersionUID for interoperability.
70 private static final long serialVersionUID = 1;
73 * The kind of this TypeCode.
75 protected final TCKind kind;
77 public PrimitiveTypeCode(TCKind a_kind)
82 public TypeCode concrete_base_type()
88 public TypeCode content_type()
94 public int default_index()
100 public TypeCode discriminator_type()
107 * Test two types for equality. The default implementation
108 * returs true of the types of the same kind.
109 * @param other the other type to compere with
110 * @return true if the types are interchangeable.
112 public boolean equal(TypeCode other)
114 return kind() == other.kind();
117 public boolean equivalent(TypeCode parm1)
119 throw new NO_IMPLEMENT();
122 public short fixed_digits()
125 throw new BadKind("fixed_digits");
128 public short fixed_scale()
131 throw new BadKind("fixed_scale");
134 public TypeCode get_compact_typecode()
136 throw new NO_IMPLEMENT();
142 throw new BadKind("id");
146 * Return the kind of this type code object.
147 * @return one of the <code>TCKind.t_..</code> fields.
157 throw new BadKind("length");
160 public int member_count()
163 throw new BadKind("member_count");
166 public Any member_label(int index)
167 throws BadKind, Bounds
169 throw new BadKind("member_label");
172 public String member_name(int index)
173 throws BadKind, Bounds
175 throw new BadKind("member_name");
178 public TypeCode member_type(int index)
179 throws BadKind, Bounds
181 throw new BadKind("member_type");
184 public short member_visibility(int index)
185 throws BadKind, Bounds
187 throw new BadKind("member_visibility");
193 throw new BadKind("name");
196 public short type_modifier()
199 throw new BadKind("type_modifier");