2 Copyright (C) 2005, 2006 Free Software Foundation, Inc.
4 This file is part of GNU Classpath.
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)
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.
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
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
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. */
39 package org.omg.CORBA;
41 import org.omg.CORBA.DynAnyPackage.Invalid;
42 import org.omg.CORBA.DynAnyPackage.InvalidValue;
43 import org.omg.CORBA.DynAnyPackage.TypeMismatch;
45 import java.io.Serializable;
48 * The DynAny interface provides possibility to access the components of
49 * the CORBA object, stored inside the {@link Any}. The {@link Any} itself
50 * allows to read, write and pass as parameter the stored value without
51 * knowning its exact data type. The DynAny and derived classes additionally
52 * allows to access the members of the sequence, structure, union and get the
53 * data about enumeration, value type and CORBA <code>fixed</code> without
54 * knowing the exact type at the run time. The returned members are also
55 * wrapped into DynAny objects, allowing them to be the nested structures.
57 * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org)
59 public interface DynAny
60 extends org.omg.CORBA.Object
63 * Copy one DynAny into another.
65 * @param from the DynAny to copy from.
66 * @throws Invalid if the source DynAny is invalid.
68 void assign(DynAny from)
77 * Returns the focused component of this DynAny. The DynAny has the internal
78 * pointer (reference) that can point to one of its components. The returned
79 * DynAny can be used to get or set the value of the focused component.
80 * If the DynAny holds a primitive type with no components, this
81 * implementation returns <code>this</code>.
83 DynAny current_component();
86 * Destroys this DynAny, freeing the used resources. In java, resources
87 * are freed by the garbage collectors, so this method typically returns
93 * Makes a DynAny from the {@link Any}. The passed {@link Any} becomes the
94 * enclosed instance of this DynAny, allowing to change/traverse the
95 * {@link Any} fields by the {@link DynAny} methods.
97 void from_any(Any an_any)
101 * Retrieves the {@link Any}, stored inside this DynAny.
103 * @throws TypeMismatch if the typecode of the accessed Any
104 * is not the same as the typecode of this DynAny.
110 * Extract the boolean value that is expected to be
111 * stored in this DynAny.
113 * @throws TypeMismatch if this DynAny holds the value of the
116 boolean get_boolean()
120 * Extract the char value that is expected to be
121 * stored in this DynAny.
123 * @throws TypeMismatch if this DynAny holds the value of the
130 * Extract the <code>double</code> value that is expected to be
131 * stored in this DynAny.
133 * @throws TypeMismatch if this DynAny holds the value of the
140 * Extract the <code>float</code> value that is expected to be
141 * stored in this DynAny.
143 * @throws TypeMismatch if this DynAny holds the value of the
150 * Extract the int (CORBA long) value that is expected to be
151 * stored in this DynAny.
153 * @throws TypeMismatch if this DynAny holds the value of the
160 * Extract the long (CORBA long long) value that is expected to be
161 * stored in this DynAny.
163 * @throws TypeMismatch if this DynAny holds the value of the
170 * Extract the byte (CORBA octet) value that is expected to be
171 * stored in this DynAny.
173 * @throws TypeMismatch if this DynAny holds the value of the
180 * Extract the CORBA object reference that is expected to be
181 * stored in this DynAny.
183 * @throws TypeMismatch if this DynAny holds the value of the
186 Object get_reference()
190 * Extract the <code>short</code> value that is expected to be
191 * stored in this DynAny.
193 * @throws TypeMismatch if this DynAny holds the value of the
200 * Extract the string value that is expected to be
201 * stored in this DynAny.
203 * @throws TypeMismatch if this DynAny holds the value of the
210 * Extract the {@link TypeCode} value that is expected to be
211 * stored in this DynAny.
213 * @throws TypeMismatch if this DynAny holds the value of the
216 TypeCode get_typecode()
220 * Extract the unsigned int (CORBA ulong) value that is expected to be
221 * stored in this DynAny.
223 * @throws TypeMismatch if this DynAny holds the value of the
230 * Extract the unsingel long (CORBA unsigned long long )value that
231 * is expected to be stored in this DynAny.
233 * @throws TypeMismatch if this DynAny holds the value of the
240 * Extract the unsigned short value that is expected to be
241 * stored in this DynAny.
243 * @throws TypeMismatch if this DynAny holds the value of the
250 * Extract the value that is expected to be
251 * stored in this DynAny.
253 * @throws TypeMismatch if this DynAny holds the value of the
256 Serializable get_val()
260 * Extract the wide (usually UTF-16) character value that is expected to be
261 * stored in this DynAny.
263 * @throws TypeMismatch if this DynAny holds the value of the
270 * Extract the wide (usually UFT-16) string that is expected to be
271 * stored in this DynAny.
273 * @throws TypeMismatch if this DynAny holds the value of the
280 * Insert the {@link Any} value into the enclosed
281 * {@link Any} inside this DynAny.
283 * @param an_any the value being inserted.
284 * @throws InvalidValue if the value type does not match the
285 * typecode of the enclosed {@link Any}.
287 void insert_any(Any an_any)
291 * Insert the boolean value into the enclosed
292 * {@link Any} inside this DynAny
293 * @param a_x the value being inserted.
294 * @throws InvalidValue if the value type does not match the
295 * typecode of the enclosed {@link Any}.
297 void insert_boolean(boolean a_x)
301 * Insert the char value into the enclosed
302 * {@link Any} inside this DynAny
303 * @param a_x the value being inserted.
304 * @throws InvalidValue if the value type does not match the
305 * typecode of the enclosed {@link Any}.
307 void insert_char(char a_x)
311 * Insert the double value into the enclosed
312 * {@link Any} inside this DynAny
313 * @param a_x the value being inserted.
314 * @throws InvalidValue if the value type does not match the
315 * typecode of the enclosed {@link Any}.
317 void insert_double(double a_x)
321 * Insert the float value into the enclosed
322 * {@link Any} inside this DynAny
323 * @param a_x the value being inserted.
324 * @throws InvalidValue if the value type does not match the
325 * typecode of the enclosed {@link Any}.
327 void insert_float(float a_x)
331 * Insert the int (CORBA long) value into the enclosed
332 * {@link Any} inside this DynAny
333 * @param a_x the value being inserted.
334 * @throws InvalidValue if the value type does not match the
335 * typecode of the enclosed {@link Any}.
337 void insert_long(int a_x)
341 * Insert the long (CORBA long long) value into the enclosed
342 * {@link Any} inside this DynAny
343 * @param a_x the value being inserted.
344 * @throws InvalidValue if the value type does not match the
345 * typecode of the enclosed {@link Any}.
347 void insert_longlong(long a_x)
351 * Insert the byte (CORBA octet) value into the enclosed
352 * {@link Any} inside this DynAny
353 * @param a_x the value being inserted.
354 * @throws InvalidValue if the value type does not match the
355 * typecode of the enclosed {@link Any}.
357 void insert_octet(byte a_x)
361 * Insert the object reference into the enclosed
362 * {@link Any} inside this DynAny
363 * @param a_x the value being inserted.
364 * @throws InvalidValue if the value type does not match the
365 * typecode of the enclosed {@link Any}.
367 void insert_reference(Object a_x)
371 * Insert the <code>short</code> value into the enclosed
372 * {@link Any} inside this DynAny
373 * @param a_x the value being inserted.
374 * @throws InvalidValue if the value type does not match the
375 * typecode of the enclosed {@link Any}.
377 void insert_short(short a_x)
381 * Insert the string value into the enclosed
382 * {@link Any} inside this DynAny
383 * @param a_x the value being inserted.
384 * @throws InvalidValue if the value type does not match the
385 * typecode of the enclosed {@link Any}.
387 void insert_string(String a_x)
391 * Insert the {@link TypeCode} value into the enclosed
392 * {@link Any} inside this DynAny
393 * @param a_x the value being inserted.
394 * @throws InvalidValue if the value type does not match the
395 * typecode of the enclosed {@link Any}.
397 void insert_typecode(TypeCode a_x)
401 * Insert the int (CORBA unsinged long) value into the enclosed
402 * {@link Any} inside this DynAny
403 * @param a_x the value being inserted.
404 * @throws InvalidValue if the value type does not match the
405 * typecode of the enclosed {@link Any}.
407 void insert_ulong(int a_x)
411 * Insert the long (CORBA unsigned long long) value into the enclosed
412 * {@link Any} inside this DynAny
413 * @param a_x the value being inserted.
414 * @throws InvalidValue if the value type does not match the
415 * typecode of the enclosed {@link Any}.
417 void insert_ulonglong(long a_x)
421 * Insert the short (CORBA unsigned short) value into the enclosed
422 * {@link Any} inside this DynAny
423 * @param a_x the value being inserted.
424 * @throws InvalidValue if the value type does not match the
425 * typecode of the enclosed {@link Any}.
427 void insert_ushort(short a_x)
431 * Insert the value into the enclosed
432 * {@link Any} inside this DynAny
433 * @param a_x the value being inserted.
434 * @throws InvalidValue if the value type does not match the
435 * typecode of the enclosed {@link Any}.
437 void insert_val(Serializable a_x)
441 * Insert the wide char (usually UTF-16) value into the enclosed
442 * {@link Any} inside this DynAny
443 * @param a_x the value being inserted.
444 * @throws InvalidValue if the value type does not match the
445 * typecode of the enclosed {@link Any}.
447 void insert_wchar(char a_x)
451 * Insert the wide string (usually UTF-16) into the enclosed
452 * {@link Any} inside this DynAny
453 * @param a_x the value being inserted.
454 * @throws InvalidValue if the value type does not match the
455 * typecode of the enclosed {@link Any}.
457 void insert_wstring(String a_x)
461 * Advances the internal pointer, described in the {@link #current_component},
462 * one position forward.
464 * @return true if the pointer now points to the new component,
465 * false if there are no more components of this DynAny holds
466 * a basic type that is not divided into components.
471 * Moves the internal pointer, described in the {@link #current_component},
472 * to the first component.
477 * Moves the internal pointer, described in the {@link #current_component},
478 * to the given position.
480 * @param p the number of the internal component on that the internal
481 * pointer must be focused.
483 * @return true on success or false if there is no component with the
484 * given number. If the DynAny holds the basic type, this method returs
485 * false p values other than 0.
490 * Returns the enclosed {@link Any}.
492 * @return the enclosed {@link Any}.
498 * Returns the typecode of the object, inserted into this
501 * @return the typecode of the inserted {@link Any} or null typecode
502 * if no {@link Any has been yet inserted}.