| 1 | /* PrimitiveTypeCode.java -- |
| 2 | Copyright (C) 2005 Free Software Foundation, Inc. |
| 3 | |
| 4 | Copyright (C) 2005 Free Software Foundation, Inc. |
| 5 | |
| 6 | This file is part of GNU Classpath. |
| 7 | |
| 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) |
| 11 | any later version. |
| 12 | |
| 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. |
| 17 | |
| 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 |
| 21 | 02110-1301 USA. |
| 22 | |
| 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 |
| 26 | combination. |
| 27 | |
| 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. */ |
| 39 | |
| 40 | package gnu.CORBA.typecodes; |
| 41 | |
| 42 | import java.io.Serializable; |
| 43 | |
| 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; |
| 51 | |
| 52 | /** |
| 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 |
| 59 | * subclasses. |
| 60 | * |
| 61 | * @author Audrius Meskauskas (AudriusA@Bioinformatics.org) |
| 62 | */ |
| 63 | public class PrimitiveTypeCode |
| 64 | extends TypeCode |
| 65 | implements IDLEntity, Serializable |
| 66 | { |
| 67 | /** |
| 68 | * Use serialVersionUID for interoperability. |
| 69 | */ |
| 70 | private static final long serialVersionUID = 1; |
| 71 | |
| 72 | /** |
| 73 | * The kind of this TypeCode. |
| 74 | */ |
| 75 | protected final TCKind kind; |
| 76 | |
| 77 | public PrimitiveTypeCode(TCKind a_kind) |
| 78 | { |
| 79 | kind = a_kind; |
| 80 | } |
| 81 | |
| 82 | public TypeCode concrete_base_type() |
| 83 | throws BadKind |
| 84 | { |
| 85 | throw new BadKind(); |
| 86 | } |
| 87 | |
| 88 | public TypeCode content_type() |
| 89 | throws BadKind |
| 90 | { |
| 91 | throw new BadKind(); |
| 92 | } |
| 93 | |
| 94 | public int default_index() |
| 95 | throws BadKind |
| 96 | { |
| 97 | throw new BadKind(); |
| 98 | } |
| 99 | |
| 100 | public TypeCode discriminator_type() |
| 101 | throws BadKind |
| 102 | { |
| 103 | throw new BadKind(); |
| 104 | } |
| 105 | |
| 106 | /** |
| 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. |
| 111 | */ |
| 112 | public boolean equal(TypeCode other) |
| 113 | { |
| 114 | return kind() == other.kind(); |
| 115 | } |
| 116 | |
| 117 | public boolean equivalent(TypeCode parm1) |
| 118 | { |
| 119 | throw new NO_IMPLEMENT(); |
| 120 | } |
| 121 | |
| 122 | public short fixed_digits() |
| 123 | throws BadKind |
| 124 | { |
| 125 | throw new BadKind("fixed_digits"); |
| 126 | } |
| 127 | |
| 128 | public short fixed_scale() |
| 129 | throws BadKind |
| 130 | { |
| 131 | throw new BadKind("fixed_scale"); |
| 132 | } |
| 133 | |
| 134 | public TypeCode get_compact_typecode() |
| 135 | { |
| 136 | throw new NO_IMPLEMENT(); |
| 137 | } |
| 138 | |
| 139 | public String id() |
| 140 | throws BadKind |
| 141 | { |
| 142 | throw new BadKind("id"); |
| 143 | } |
| 144 | |
| 145 | /** |
| 146 | * Return the kind of this type code object. |
| 147 | * @return one of the <code>TCKind.t_..</code> fields. |
| 148 | */ |
| 149 | public TCKind kind() |
| 150 | { |
| 151 | return kind; |
| 152 | } |
| 153 | |
| 154 | public int length() |
| 155 | throws BadKind |
| 156 | { |
| 157 | throw new BadKind("length"); |
| 158 | } |
| 159 | |
| 160 | public int member_count() |
| 161 | throws BadKind |
| 162 | { |
| 163 | throw new BadKind("member_count"); |
| 164 | } |
| 165 | |
| 166 | public Any member_label(int index) |
| 167 | throws BadKind, Bounds |
| 168 | { |
| 169 | throw new BadKind("member_label"); |
| 170 | } |
| 171 | |
| 172 | public String member_name(int index) |
| 173 | throws BadKind, Bounds |
| 174 | { |
| 175 | throw new BadKind("member_name"); |
| 176 | } |
| 177 | |
| 178 | public TypeCode member_type(int index) |
| 179 | throws BadKind, Bounds |
| 180 | { |
| 181 | throw new BadKind("member_type"); |
| 182 | } |
| 183 | |
| 184 | public short member_visibility(int index) |
| 185 | throws BadKind, Bounds |
| 186 | { |
| 187 | throw new BadKind("member_visibility"); |
| 188 | } |
| 189 | |
| 190 | public String name() |
| 191 | throws BadKind |
| 192 | { |
| 193 | throw new BadKind("name"); |
| 194 | } |
| 195 | |
| 196 | public short type_modifier() |
| 197 | throws BadKind |
| 198 | { |
| 199 | throw new BadKind("type_modifier"); |
| 200 | } |
| 201 | } |