DynAny.java 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508
  1. /* DynAny.java --
  2. Copyright (C) 2005, 2006, 2007 Free Software Foundation, Inc.
  3. This file is part of GNU Classpath.
  4. GNU Classpath is free software; you can redistribute it and/or modify
  5. it under the terms of the GNU General Public License as published by
  6. the Free Software Foundation; either version 2, or (at your option)
  7. any later version.
  8. GNU Classpath is distributed in the hope that it will be useful, but
  9. WITHOUT ANY WARRANTY; without even the implied warranty of
  10. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  11. General Public License for more details.
  12. You should have received a copy of the GNU General Public License
  13. along with GNU Classpath; see the file COPYING. If not, write to the
  14. Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
  15. 02110-1301 USA.
  16. Linking this library statically or dynamically with other modules is
  17. making a combined work based on this library. Thus, the terms and
  18. conditions of the GNU General Public License cover the whole
  19. combination.
  20. As a special exception, the copyright holders of this library give you
  21. permission to link this library with independent modules to produce an
  22. executable, regardless of the license terms of these independent
  23. modules, and to copy and distribute the resulting executable under
  24. terms of your choice, provided that you also meet, for each linked
  25. independent module, the terms and conditions of the license of that
  26. module. An independent module is a module which is not derived from
  27. or based on this library. If you modify this library, you may extend
  28. this exception to your version of the library, but you are not
  29. obligated to do so. If you do not wish to do so, delete this
  30. exception statement from your version. */
  31. package org.omg.CORBA;
  32. import org.omg.CORBA.DynAnyPackage.Invalid;
  33. import org.omg.CORBA.DynAnyPackage.InvalidValue;
  34. import org.omg.CORBA.DynAnyPackage.TypeMismatch;
  35. import java.io.Serializable;
  36. /**
  37. * The DynAny interface provides possibility to access the components of
  38. * the CORBA object, stored inside the {@link Any}. The {@link Any} itself
  39. * allows to read, write and pass as parameter the stored value without
  40. * knowning its exact data type. The DynAny and derived classes additionally
  41. * allows to access the members of the sequence, structure, union and get the
  42. * data about enumeration, value type and CORBA <code>fixed</code> without
  43. * knowing the exact type at the run time. The returned members are also
  44. * wrapped into DynAny objects, allowing them to be the nested structures.
  45. *
  46. * @deprecated by {@link org.omg.DynamicAny.DynAny}
  47. *
  48. * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org)
  49. */
  50. public interface DynAny
  51. extends org.omg.CORBA.Object
  52. {
  53. /**
  54. * Copy one DynAny into another.
  55. *
  56. * @param from the DynAny to copy from.
  57. * @throws Invalid if the source DynAny is invalid.
  58. */
  59. void assign(DynAny from)
  60. throws Invalid;
  61. /**
  62. * Clones this DynAny.
  63. */
  64. DynAny copy();
  65. /**
  66. * Returns the focused component of this DynAny. The DynAny has the internal
  67. * pointer (reference) that can point to one of its components. The returned
  68. * DynAny can be used to get or set the value of the focused component.
  69. * If the DynAny holds a primitive type with no components, this
  70. * implementation returns <code>this</code>.
  71. */
  72. DynAny current_component();
  73. /**
  74. * Destroys this DynAny, freeing the used resources. In java, resources
  75. * are freed by the garbage collectors, so this method typically returns
  76. * without action.
  77. */
  78. void destroy();
  79. /**
  80. * Makes a DynAny from the {@link Any}. The passed {@link Any} becomes the
  81. * enclosed instance of this DynAny, allowing to change/traverse the
  82. * {@link Any} fields by the {@link DynAny} methods.
  83. */
  84. void from_any(Any an_any)
  85. throws Invalid;
  86. /**
  87. * Retrieves the {@link Any}, stored inside this DynAny.
  88. *
  89. * @throws TypeMismatch if the typecode of the accessed Any
  90. * is not the same as the typecode of this DynAny.
  91. */
  92. Any get_any()
  93. throws TypeMismatch;
  94. /**
  95. * Extract the boolean value that is expected to be
  96. * stored in this DynAny.
  97. *
  98. * @throws TypeMismatch if this DynAny holds the value of the
  99. * different type.
  100. */
  101. boolean get_boolean()
  102. throws TypeMismatch;
  103. /**
  104. * Extract the char value that is expected to be
  105. * stored in this DynAny.
  106. *
  107. * @throws TypeMismatch if this DynAny holds the value of the
  108. * different type.
  109. */
  110. char get_char()
  111. throws TypeMismatch;
  112. /**
  113. * Extract the <code>double</code> value that is expected to be
  114. * stored in this DynAny.
  115. *
  116. * @throws TypeMismatch if this DynAny holds the value of the
  117. * different type.
  118. */
  119. double get_double()
  120. throws TypeMismatch;
  121. /**
  122. * Extract the <code>float</code> value that is expected to be
  123. * stored in this DynAny.
  124. *
  125. * @throws TypeMismatch if this DynAny holds the value of the
  126. * different type.
  127. */
  128. float get_float()
  129. throws TypeMismatch;
  130. /**
  131. * Extract the int (CORBA long) value that is expected to be
  132. * stored in this DynAny.
  133. *
  134. * @throws TypeMismatch if this DynAny holds the value of the
  135. * different type.
  136. */
  137. int get_long()
  138. throws TypeMismatch;
  139. /**
  140. * Extract the long (CORBA long long) value that is expected to be
  141. * stored in this DynAny.
  142. *
  143. * @throws TypeMismatch if this DynAny holds the value of the
  144. * different type.
  145. */
  146. long get_longlong()
  147. throws TypeMismatch;
  148. /**
  149. * Extract the byte (CORBA octet) value that is expected to be
  150. * stored in this DynAny.
  151. *
  152. * @throws TypeMismatch if this DynAny holds the value of the
  153. * different type.
  154. */
  155. byte get_octet()
  156. throws TypeMismatch;
  157. /**
  158. * Extract the CORBA object reference that is expected to be
  159. * stored in this DynAny.
  160. *
  161. * @throws TypeMismatch if this DynAny holds the value of the
  162. * different type.
  163. */
  164. Object get_reference()
  165. throws TypeMismatch;
  166. /**
  167. * Extract the <code>short</code> value that is expected to be
  168. * stored in this DynAny.
  169. *
  170. * @throws TypeMismatch if this DynAny holds the value of the
  171. * different type.
  172. */
  173. short get_short()
  174. throws TypeMismatch;
  175. /**
  176. * Extract the string value that is expected to be
  177. * stored in this DynAny.
  178. *
  179. * @throws TypeMismatch if this DynAny holds the value of the
  180. * different type.
  181. */
  182. String get_string()
  183. throws TypeMismatch;
  184. /**
  185. * Extract the {@link TypeCode} value that is expected to be
  186. * stored in this DynAny.
  187. *
  188. * @throws TypeMismatch if this DynAny holds the value of the
  189. * different type.
  190. */
  191. TypeCode get_typecode()
  192. throws TypeMismatch;
  193. /**
  194. * Extract the unsigned int (CORBA ulong) value that is expected to be
  195. * stored in this DynAny.
  196. *
  197. * @throws TypeMismatch if this DynAny holds the value of the
  198. * different type.
  199. */
  200. int get_ulong()
  201. throws TypeMismatch;
  202. /**
  203. * Extract the unsingel long (CORBA unsigned long long )value that
  204. * is expected to be stored in this DynAny.
  205. *
  206. * @throws TypeMismatch if this DynAny holds the value of the
  207. * different type.
  208. */
  209. long get_ulonglong()
  210. throws TypeMismatch;
  211. /**
  212. * Extract the unsigned short value that is expected to be
  213. * stored in this DynAny.
  214. *
  215. * @throws TypeMismatch if this DynAny holds the value of the
  216. * different type.
  217. */
  218. short get_ushort()
  219. throws TypeMismatch;
  220. /**
  221. * Extract the value that is expected to be
  222. * stored in this DynAny.
  223. *
  224. * @throws TypeMismatch if this DynAny holds the value of the
  225. * different type.
  226. */
  227. Serializable get_val()
  228. throws TypeMismatch;
  229. /**
  230. * Extract the wide (usually UTF-16) character value that is expected to be
  231. * stored in this DynAny.
  232. *
  233. * @throws TypeMismatch if this DynAny holds the value of the
  234. * different type.
  235. */
  236. char get_wchar()
  237. throws TypeMismatch;
  238. /**
  239. * Extract the wide (usually UFT-16) string that is expected to be
  240. * stored in this DynAny.
  241. *
  242. * @throws TypeMismatch if this DynAny holds the value of the
  243. * different type.
  244. */
  245. String get_wstring()
  246. throws TypeMismatch;
  247. /**
  248. * Insert the {@link Any} value into the enclosed
  249. * {@link Any} inside this DynAny.
  250. *
  251. * @param an_any the value being inserted.
  252. * @throws InvalidValue if the value type does not match the
  253. * typecode of the enclosed {@link Any}.
  254. */
  255. void insert_any(Any an_any)
  256. throws InvalidValue;
  257. /**
  258. * Insert the boolean value into the enclosed
  259. * {@link Any} inside this DynAny
  260. * @param a_x the value being inserted.
  261. * @throws InvalidValue if the value type does not match the
  262. * typecode of the enclosed {@link Any}.
  263. */
  264. void insert_boolean(boolean a_x)
  265. throws InvalidValue;
  266. /**
  267. * Insert the char value into the enclosed
  268. * {@link Any} inside this DynAny
  269. * @param a_x the value being inserted.
  270. * @throws InvalidValue if the value type does not match the
  271. * typecode of the enclosed {@link Any}.
  272. */
  273. void insert_char(char a_x)
  274. throws InvalidValue;
  275. /**
  276. * Insert the double value into the enclosed
  277. * {@link Any} inside this DynAny
  278. * @param a_x the value being inserted.
  279. * @throws InvalidValue if the value type does not match the
  280. * typecode of the enclosed {@link Any}.
  281. */
  282. void insert_double(double a_x)
  283. throws InvalidValue;
  284. /**
  285. * Insert the float value into the enclosed
  286. * {@link Any} inside this DynAny
  287. * @param a_x the value being inserted.
  288. * @throws InvalidValue if the value type does not match the
  289. * typecode of the enclosed {@link Any}.
  290. */
  291. void insert_float(float a_x)
  292. throws InvalidValue;
  293. /**
  294. * Insert the int (CORBA long) value into the enclosed
  295. * {@link Any} inside this DynAny
  296. * @param a_x the value being inserted.
  297. * @throws InvalidValue if the value type does not match the
  298. * typecode of the enclosed {@link Any}.
  299. */
  300. void insert_long(int a_x)
  301. throws InvalidValue;
  302. /**
  303. * Insert the long (CORBA long long) value into the enclosed
  304. * {@link Any} inside this DynAny
  305. * @param a_x the value being inserted.
  306. * @throws InvalidValue if the value type does not match the
  307. * typecode of the enclosed {@link Any}.
  308. */
  309. void insert_longlong(long a_x)
  310. throws InvalidValue;
  311. /**
  312. * Insert the byte (CORBA octet) value into the enclosed
  313. * {@link Any} inside this DynAny
  314. * @param a_x the value being inserted.
  315. * @throws InvalidValue if the value type does not match the
  316. * typecode of the enclosed {@link Any}.
  317. */
  318. void insert_octet(byte a_x)
  319. throws InvalidValue;
  320. /**
  321. * Insert the object reference 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}.
  326. */
  327. void insert_reference(Object a_x)
  328. throws InvalidValue;
  329. /**
  330. * Insert the <code>short</code> value into the enclosed
  331. * {@link Any} inside this DynAny
  332. * @param a_x the value being inserted.
  333. * @throws InvalidValue if the value type does not match the
  334. * typecode of the enclosed {@link Any}.
  335. */
  336. void insert_short(short a_x)
  337. throws InvalidValue;
  338. /**
  339. * Insert the string value into the enclosed
  340. * {@link Any} inside this DynAny
  341. * @param a_x the value being inserted.
  342. * @throws InvalidValue if the value type does not match the
  343. * typecode of the enclosed {@link Any}.
  344. */
  345. void insert_string(String a_x)
  346. throws InvalidValue;
  347. /**
  348. * Insert the {@link TypeCode} value into the enclosed
  349. * {@link Any} inside this DynAny
  350. * @param a_x the value being inserted.
  351. * @throws InvalidValue if the value type does not match the
  352. * typecode of the enclosed {@link Any}.
  353. */
  354. void insert_typecode(TypeCode a_x)
  355. throws InvalidValue;
  356. /**
  357. * Insert the int (CORBA unsinged long) value into the enclosed
  358. * {@link Any} inside this DynAny
  359. * @param a_x the value being inserted.
  360. * @throws InvalidValue if the value type does not match the
  361. * typecode of the enclosed {@link Any}.
  362. */
  363. void insert_ulong(int a_x)
  364. throws InvalidValue;
  365. /**
  366. * Insert the long (CORBA unsigned long long) value into the enclosed
  367. * {@link Any} inside this DynAny
  368. * @param a_x the value being inserted.
  369. * @throws InvalidValue if the value type does not match the
  370. * typecode of the enclosed {@link Any}.
  371. */
  372. void insert_ulonglong(long a_x)
  373. throws InvalidValue;
  374. /**
  375. * Insert the short (CORBA unsigned short) value into the enclosed
  376. * {@link Any} inside this DynAny
  377. * @param a_x the value being inserted.
  378. * @throws InvalidValue if the value type does not match the
  379. * typecode of the enclosed {@link Any}.
  380. */
  381. void insert_ushort(short a_x)
  382. throws InvalidValue;
  383. /**
  384. * Insert the value into the enclosed
  385. * {@link Any} inside this DynAny
  386. * @param a_x the value being inserted.
  387. * @throws InvalidValue if the value type does not match the
  388. * typecode of the enclosed {@link Any}.
  389. */
  390. void insert_val(Serializable a_x)
  391. throws InvalidValue;
  392. /**
  393. * Insert the wide char (usually UTF-16) value into the enclosed
  394. * {@link Any} inside this DynAny
  395. * @param a_x the value being inserted.
  396. * @throws InvalidValue if the value type does not match the
  397. * typecode of the enclosed {@link Any}.
  398. */
  399. void insert_wchar(char a_x)
  400. throws InvalidValue;
  401. /**
  402. * Insert the wide string (usually UTF-16) into the enclosed
  403. * {@link Any} inside this DynAny
  404. * @param a_x the value being inserted.
  405. * @throws InvalidValue if the value type does not match the
  406. * typecode of the enclosed {@link Any}.
  407. */
  408. void insert_wstring(String a_x)
  409. throws InvalidValue;
  410. /**
  411. * Advances the internal pointer, described in the {@link #current_component},
  412. * one position forward.
  413. *
  414. * @return true if the pointer now points to the new component,
  415. * false if there are no more components of this DynAny holds
  416. * a basic type that is not divided into components.
  417. */
  418. boolean next();
  419. /**
  420. * Moves the internal pointer, described in the {@link #current_component},
  421. * to the first component.
  422. */
  423. void rewind();
  424. /**
  425. * Moves the internal pointer, described in the {@link #current_component},
  426. * to the given position.
  427. *
  428. * @param p the number of the internal component on that the internal
  429. * pointer must be focused.
  430. *
  431. * @return true on success or false if there is no component with the
  432. * given number. If the DynAny holds the basic type, this method returs
  433. * false p values other than 0.
  434. */
  435. boolean seek(int p);
  436. /**
  437. * Returns the enclosed {@link Any}.
  438. *
  439. * @return the enclosed {@link Any}.
  440. */
  441. Any to_any()
  442. throws Invalid;
  443. /**
  444. * Returns the typecode of the object, inserted into this
  445. * DynAny.
  446. *
  447. * @return the typecode of the inserted {@link Any} or null typecode
  448. * if no {@link Any has been yet inserted}.
  449. */
  450. TypeCode type();
  451. }