1 |
775 |
jeremybenn |
/* 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 org.omg.CORBA.TypeCodePackage.BadKind;
|
42 |
|
|
import org.omg.CORBA.portable.IDLEntity;
|
43 |
|
|
|
44 |
|
|
import java.io.Serializable;
|
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 |
|
|
* For value types that support inheritance this method returns the
|
61 |
|
|
* of the ancestor type code.
|
62 |
|
|
*
|
63 |
|
|
* @return the ancestor TypeCode.
|
64 |
|
|
*
|
65 |
|
|
* @throws BadKind for all typecodes except the value type typecodes.
|
66 |
|
|
*/
|
67 |
|
|
public abstract TypeCode concrete_base_type()
|
68 |
|
|
throws BadKind;
|
69 |
|
|
|
70 |
|
|
/**
|
71 |
|
|
* For sequences, arrays, aliases and value boxes, returns the IDL type for
|
72 |
|
|
* the members of the object.
|
73 |
|
|
* @return a TypeCode of the memebers of this type.
|
74 |
|
|
* @throws BadKind for types other than
|
75 |
|
|
* sequences, arrays, aliases and value boxes.
|
76 |
|
|
*/
|
77 |
|
|
public abstract TypeCode content_type()
|
78 |
|
|
throws BadKind;
|
79 |
|
|
|
80 |
|
|
/**
|
81 |
|
|
* For unions, returs the index of the default member.
|
82 |
|
|
* @return the index of the default member, -1 if there is
|
83 |
|
|
* no default member.
|
84 |
|
|
* @throws BadKind if this type is not
|
85 |
|
|
* a union.
|
86 |
|
|
*/
|
87 |
|
|
public abstract int default_index()
|
88 |
|
|
throws BadKind;
|
89 |
|
|
|
90 |
|
|
/**
|
91 |
|
|
* Returs definition of member labels for untions
|
92 |
|
|
* @return a TypeCode, describing all non-default member labels.
|
93 |
|
|
* @throws BadKind if this type is not a
|
94 |
|
|
* union.
|
95 |
|
|
*/
|
96 |
|
|
public abstract TypeCode discriminator_type()
|
97 |
|
|
throws BadKind;
|
98 |
|
|
|
99 |
|
|
/**
|
100 |
|
|
* Test two types for equality.
|
101 |
|
|
*
|
102 |
|
|
* @param other the other type to compere with
|
103 |
|
|
* @return true if the types are interchangeable.
|
104 |
|
|
*/
|
105 |
|
|
public abstract boolean equal(TypeCode other);
|
106 |
|
|
|
107 |
|
|
/**
|
108 |
|
|
* Following the current 1.4 API specifcation, this should just throw
|
109 |
|
|
* NO_IMPLEMENT.
|
110 |
|
|
* @throws org.omg.CORBA.NO_IMPLEMENT, always.
|
111 |
|
|
*/
|
112 |
|
|
public abstract boolean equivalent(TypeCode other);
|
113 |
|
|
|
114 |
|
|
/**
|
115 |
|
|
* For the fixed type, returns the number of digits.
|
116 |
|
|
* @return the number of digits for the fixed type
|
117 |
|
|
* @throws BadKind if this is not a fixed
|
118 |
|
|
* type.
|
119 |
|
|
*/
|
120 |
|
|
public abstract short fixed_digits()
|
121 |
|
|
throws BadKind;
|
122 |
|
|
|
123 |
|
|
/**
|
124 |
|
|
* Returns the scale for the fixed type. The returned value can be either
|
125 |
|
|
* positive (the number of digits to the right of the decimal point) or
|
126 |
|
|
* negative (adds zeros to the left of the decimal point).
|
127 |
|
|
* @return the scale.
|
128 |
|
|
* @throws BadKind if this is not a fixed
|
129 |
|
|
* type.
|
130 |
|
|
*/
|
131 |
|
|
public abstract short fixed_scale()
|
132 |
|
|
throws BadKind;
|
133 |
|
|
|
134 |
|
|
/**
|
135 |
|
|
* Returns a version of this instance without the optional memeber and
|
136 |
|
|
* member name fields.
|
137 |
|
|
* @return the truncated version.
|
138 |
|
|
*/
|
139 |
|
|
public abstract TypeCode get_compact_typecode();
|
140 |
|
|
|
141 |
|
|
/**
|
142 |
|
|
* Returns the RepositoryId globally identifying the type, defined by
|
143 |
|
|
* this TypeCode.
|
144 |
|
|
* @return tje RepositoryId. In some cases, it may be an empty string.
|
145 |
|
|
* @throws BadKind if the type is other than
|
146 |
|
|
* reference, structure, union, enumeration, alias, exception, valuetype,
|
147 |
|
|
* boxed valuetype and also native and abstract interfaces.
|
148 |
|
|
*/
|
149 |
|
|
public abstract String id()
|
150 |
|
|
throws BadKind;
|
151 |
|
|
|
152 |
|
|
/**
|
153 |
|
|
* Return the kind of this type code object.
|
154 |
|
|
* @return one of the <code>TCKind.t_..</code> fields.
|
155 |
|
|
*/
|
156 |
|
|
public abstract TCKind kind();
|
157 |
|
|
|
158 |
|
|
/**
|
159 |
|
|
* Returns the number of elements in the type. For arrays, this
|
160 |
|
|
* method returns the length of the array. For strings and sequences,
|
161 |
|
|
* it returns the bound of the type, zero indicating the unbounded
|
162 |
|
|
* type.
|
163 |
|
|
*
|
164 |
|
|
* @return length or bound
|
165 |
|
|
*
|
166 |
|
|
* @throws BadKind for types other than
|
167 |
|
|
* string, sequence and array.
|
168 |
|
|
*/
|
169 |
|
|
public abstract int length()
|
170 |
|
|
throws BadKind;
|
171 |
|
|
|
172 |
|
|
/**
|
173 |
|
|
* Returns the number of type memebers.
|
174 |
|
|
*
|
175 |
|
|
* @return the number of memebers
|
176 |
|
|
* @throws BadKind for types other than
|
177 |
|
|
* structure, union, enumeration or exception.
|
178 |
|
|
*/
|
179 |
|
|
public abstract int member_count()
|
180 |
|
|
throws BadKind;
|
181 |
|
|
|
182 |
|
|
/**
|
183 |
|
|
* Retrieves the label of the union member at the given index.
|
184 |
|
|
* For the default member, this label is the zero octet.
|
185 |
|
|
*
|
186 |
|
|
* @param index the index of the union memeber.
|
187 |
|
|
*
|
188 |
|
|
* @return the label
|
189 |
|
|
*
|
190 |
|
|
* @throws BadKind if this is not a union
|
191 |
|
|
* type.
|
192 |
|
|
* @throws org.omg.CORBA.TypeCodePackage.Bounds if the index is out of
|
193 |
|
|
* valid bounds.
|
194 |
|
|
*/
|
195 |
|
|
public abstract Any member_label(int index)
|
196 |
|
|
throws BadKind,
|
197 |
|
|
org.omg.CORBA.TypeCodePackage.Bounds;
|
198 |
|
|
|
199 |
|
|
/**
|
200 |
|
|
* Retrieves the simple name of the member identified by the given index.
|
201 |
|
|
*
|
202 |
|
|
* @param index the index of the memeber.
|
203 |
|
|
*
|
204 |
|
|
* @return the member name that in some cases can be an empty string.
|
205 |
|
|
*
|
206 |
|
|
* @throws BadKind for types other than
|
207 |
|
|
* structure, union or enumeration.
|
208 |
|
|
* @throws org.omg.CORBA.TypeCodePackage.Bounds if the index is out of
|
209 |
|
|
* valid bounds.
|
210 |
|
|
*/
|
211 |
|
|
public abstract String member_name(int index)
|
212 |
|
|
throws BadKind,
|
213 |
|
|
org.omg.CORBA.TypeCodePackage.Bounds;
|
214 |
|
|
|
215 |
|
|
/**
|
216 |
|
|
* Retrieves the member type of the member identified by the given index.
|
217 |
|
|
*
|
218 |
|
|
* @param index the index of the memeber.
|
219 |
|
|
*
|
220 |
|
|
* @return the member type.
|
221 |
|
|
*
|
222 |
|
|
* @throws BadKind for types other than
|
223 |
|
|
* structure, union, enumeration or exception.
|
224 |
|
|
* @throws org.omg.CORBA.TypeCodePackage.Bounds if the index is out of
|
225 |
|
|
* valid bounds.
|
226 |
|
|
*/
|
227 |
|
|
public abstract TypeCode member_type(int index)
|
228 |
|
|
throws BadKind,
|
229 |
|
|
org.omg.CORBA.TypeCodePackage.Bounds;
|
230 |
|
|
|
231 |
|
|
/**
|
232 |
|
|
* Returns the visibility scope of the member at the given index.
|
233 |
|
|
* This operation can only be invoked on non-boxed value types.
|
234 |
|
|
*
|
235 |
|
|
* @param index the index of the member
|
236 |
|
|
*
|
237 |
|
|
* @return either PRIVATE_MEMBER.value or PUBLIC_MEMBER.value
|
238 |
|
|
*
|
239 |
|
|
* @throws BadKind if this is not a non boxed
|
240 |
|
|
* value type.
|
241 |
|
|
*
|
242 |
|
|
* @throws org.omg.CORBA.TypeCodePackage.Bounds if the index is out of
|
243 |
|
|
* valid bounds.
|
244 |
|
|
*/
|
245 |
|
|
public abstract short member_visibility(int index)
|
246 |
|
|
throws BadKind,
|
247 |
|
|
org.omg.CORBA.TypeCodePackage.Bounds;
|
248 |
|
|
|
249 |
|
|
/**
|
250 |
|
|
* Retrieves the simple name identifying this TypeCode object
|
251 |
|
|
* within its enclosing scope.
|
252 |
|
|
* @return the name, can be an empty string.
|
253 |
|
|
* @throws BadKind for typer other than
|
254 |
|
|
* reference, structure, union, enumeration, alias, exception,
|
255 |
|
|
* valuetype, boxed valuetype, native, and abstract interface
|
256 |
|
|
*/
|
257 |
|
|
public abstract String name()
|
258 |
|
|
throws BadKind;
|
259 |
|
|
|
260 |
|
|
/**
|
261 |
|
|
* Returns a constant indicating the modifier of the value type.
|
262 |
|
|
*
|
263 |
|
|
* @return one of the following constants:
|
264 |
|
|
* VM_NONE.value, VM_ABSTRACT.value, VM_CUSTOM.value, or
|
265 |
|
|
* VM_TRUNCATABLE.value,
|
266 |
|
|
*
|
267 |
|
|
* @throws BadKind for all types other than value type.
|
268 |
|
|
*/
|
269 |
|
|
public abstract short type_modifier()
|
270 |
|
|
throws BadKind;
|
271 |
|
|
}
|