Any.java 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461
  1. /* Any.java --
  2. Copyright (C) 2005 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 java.io.Serializable;
  33. import org.omg.CORBA.portable.IDLEntity;
  34. /**
  35. * A container that can store a value of either user defined or
  36. * primitive IDL type.
  37. *
  38. * @author Audrius Meskauskas (AudriusA@Bioinformatics.org)
  39. */
  40. public abstract class Any
  41. implements Serializable, IDLEntity
  42. {
  43. /**
  44. * Using v 1.4 serialVersionUID for interoperability.
  45. */
  46. private static final long serialVersionUID = 1217179597823814463L;
  47. /**
  48. * Creates an input stream from that this Any object's value can be
  49. * read (unmarshalled).
  50. */
  51. public abstract org.omg.CORBA.portable.InputStream create_input_stream();
  52. /**
  53. * Creates an output stream into which this <code>Any</code> object's
  54. * value can be written (marshalled).
  55. *
  56. * @return the newly created output stream.
  57. */
  58. public abstract org.omg.CORBA.portable.OutputStream create_output_stream();
  59. /**
  60. * Compare this <code>Any</code> with another <code>Any</code>.
  61. *
  62. * @param other the other instance to compare with.
  63. *
  64. * @return true if both values and value typecodes are equal,
  65. * false otherwise.
  66. */
  67. public abstract boolean equal(Any other);
  68. /**
  69. * Extract the CORBA <code>Object</code> from this <code>Any</code>
  70. * @throws BAD_OPERATION if this instance contains value other
  71. * than <code>Object</code> or the value has not been set.
  72. */
  73. public abstract org.omg.CORBA.Object extract_Object()
  74. throws BAD_OPERATION;
  75. /**
  76. * Extract the CORBA <code>Principal</code> from this <code>Any</code>
  77. *
  78. * @throws NO_IMPLEMENT, always.
  79. *
  80. * @deprecated by CORBA 2.2.
  81. */
  82. public Principal extract_Principal()
  83. {
  84. throw new NO_IMPLEMENT();
  85. }
  86. /**
  87. * Extract an arbitrary {@link org.omg.CORBA.portable.Streamable } from
  88. * this <code>Any</code>.
  89. *
  90. * @throws BAD_INV_ORDER if the caller has invoked operations in the
  91. * wrong order.
  92. *
  93. * @throws NO_IMPLEMENT, always (override to get functionality).
  94. */
  95. public org.omg.CORBA.portable.Streamable extract_Streamable()
  96. throws org.omg.CORBA.BAD_INV_ORDER
  97. {
  98. throw new NO_IMPLEMENT();
  99. }
  100. /**
  101. * Extract the TypeCode from this <code>Any</code> value field.
  102. *
  103. * @throws BAD_OPERATION if this instance contains value other
  104. * than <code>TypeCode</code> or the value has not been set.
  105. */
  106. public abstract TypeCode extract_TypeCode()
  107. throws BAD_OPERATION;
  108. /**
  109. * Extract the CORBA <code>Value</code> from this <code>Any</code>
  110. * @throws BAD_OPERATION if this instance contains value other
  111. * than <code>Value</code> or the value has not been set.
  112. */
  113. public abstract java.io.Serializable extract_Value()
  114. throws BAD_OPERATION;
  115. /**
  116. * Extract another <code>Any</code> from this <code>Any</code>.
  117. *
  118. * @throws BAD_OPERATION if this instance contains value other
  119. * than <code>any</code> or the value has not been set.
  120. */
  121. public abstract Any extract_any()
  122. throws BAD_OPERATION;
  123. /**
  124. * Extract the CORBA <code>boolean</code> from this <code>Any</code>.
  125. *
  126. * @throws BAD_OPERATION if this instance contains value other
  127. * than <code>boolean</code> or the value has not been set.
  128. */
  129. public abstract boolean extract_boolean()
  130. throws BAD_OPERATION;
  131. /**
  132. * Extract the CORBA <code>char</code> from this <code>Any</code>.
  133. *
  134. * @throws BAD_OPERATION if this instance contains value other
  135. * than <code>char</code> or the value has not been set.
  136. */
  137. public abstract char extract_char()
  138. throws BAD_OPERATION;
  139. /**
  140. * Extract the CORBA <code>double</code> from this <code>Any</code>.
  141. *
  142. * @throws BAD_OPERATION if this instance contains value other
  143. * than <code>double</code> or the value has not been set.
  144. */
  145. public abstract double extract_double()
  146. throws BAD_OPERATION;
  147. /**
  148. * Extract the CORBA <code>fixed</code> from this <code>Any</code>.
  149. *
  150. * @throws BAD_OPERATION if this instance contains value other
  151. * than <code>fixed</code> or the value has not been set.
  152. *
  153. * @throws NO_IMPLEMENT, always (override to get functionality).
  154. */
  155. public java.math.BigDecimal extract_fixed()
  156. throws BAD_OPERATION
  157. {
  158. throw new NO_IMPLEMENT();
  159. }
  160. /**
  161. * Extract the CORBA <code>float</code> from this <code>Any</code>.
  162. *
  163. * @throws BAD_OPERATION if this instance contains value other
  164. * than <code>float</code> or the value has not been set.
  165. */
  166. public abstract float extract_float()
  167. throws BAD_OPERATION;
  168. /**
  169. * Extract the CORBA <code>long</code> from this <code>Any</code>.
  170. *
  171. * @throws BAD_OPERATION if this instance contains value other
  172. * than <code>long</code> or the value has not been set.
  173. */
  174. public abstract int extract_long()
  175. throws BAD_OPERATION;
  176. /**
  177. * Extract the CORBA <code>long long</code> from this <code>Any</code>.
  178. *
  179. * @throws BAD_OPERATION if this instance contains value other
  180. * than <code>longlong</code> or the value has not been set.
  181. */
  182. public abstract long extract_longlong()
  183. throws BAD_OPERATION;
  184. /**
  185. * Extract the CORBA <code>octet</code> from this <code>Any</code>.
  186. *
  187. * @throws BAD_OPERATION if this instance contains value other
  188. * than <code>octet</code> or the value has not been set.
  189. */
  190. public abstract byte extract_octet()
  191. throws BAD_OPERATION;
  192. /**
  193. * Extract the CORBA <code>short</code> from this <code>Any</code>.
  194. *
  195. * @throws BAD_OPERATION if this instance contains value other
  196. * than <code>short</code> or the value has not been set.
  197. */
  198. public abstract short extract_short()
  199. throws BAD_OPERATION;
  200. /**
  201. * Extract the CORBA <code>string</code> from this <code>Any</code>.
  202. *
  203. * @throws BAD_OPERATION if this instance contains value other
  204. * than <code>string</code> or the value has not been set.
  205. */
  206. public abstract String extract_string()
  207. throws BAD_OPERATION;
  208. /**
  209. * Extract the CORBA unsigned <code>long</code> from this <code>Any</code>
  210. * @throws BAD_OPERATION if this instance contains value other
  211. * than unsigned <code>long</code> or the value has not been set.
  212. */
  213. public abstract int extract_ulong()
  214. throws BAD_OPERATION;
  215. /**
  216. * Extract the CORBA unsigned <code>long long</code> from this
  217. * <code>Any</code>.
  218. *
  219. * @throws BAD_OPERATION if this instance contains value other
  220. * than unsigned <code>long long</code> or the value has not been set.
  221. */
  222. public abstract long extract_ulonglong()
  223. throws BAD_OPERATION;
  224. /**
  225. * Extract the CORBA unsigned <code>short</code> from this <code>Any</code>
  226. * @throws BAD_OPERATION if this instance contains value other
  227. * than unsigned <code>short</code> or the value has not been set.
  228. */
  229. public abstract short extract_ushort()
  230. throws BAD_OPERATION;
  231. /**
  232. * Extract the CORBA <code>wchar</code> from this <code>Any</code>
  233. * @throws BAD_OPERATION if this instance contains value other
  234. * than <code>wchar</code> or the value has not been set.
  235. */
  236. public abstract char extract_wchar()
  237. throws BAD_OPERATION;
  238. /**
  239. * Extract the CORBA <code>wstring</code> from this <code>Any</code>
  240. * @throws BAD_OPERATION if this instance contains value other
  241. * than <code>wstring</code> or the value has not been set.
  242. */
  243. public abstract String extract_wstring()
  244. throws BAD_OPERATION;
  245. /**
  246. * Insert the CORBA <code>Object</code> into this <code>Any</code>
  247. */
  248. public abstract void insert_Object(org.omg.CORBA.Object x, TypeCode typecode);
  249. /**
  250. * Insert the CORBA <code>Object</code> into this <code>Any</code>
  251. */
  252. public abstract void insert_Object(org.omg.CORBA.Object x);
  253. /**
  254. * Insert the CORBA <code>Principal</code> into this <code>Any</code>.
  255. * @deprecated by CORBA 2.2.
  256. */
  257. public void insert_Principal(Principal x)
  258. {
  259. throw new NO_IMPLEMENT();
  260. }
  261. /**
  262. * Insert the CORBA <code>Streamable</code> into this <code>Any</code>
  263. */
  264. public void insert_Streamable(org.omg.CORBA.portable.Streamable x)
  265. {
  266. throw new NO_IMPLEMENT();
  267. }
  268. /**
  269. * Insert the CORBA <code>TypeCode</code> into this <code>Any</code>
  270. * value field.
  271. */
  272. public abstract void insert_TypeCode(TypeCode typecode);
  273. /**
  274. * Insert the CORBA <code>Value</code> into this <code>Any</code>.
  275. *
  276. * The type of the Any should be set (by {@link #type(TypeCode)})
  277. * before inserting the value.
  278. */
  279. public abstract void insert_Value(Serializable x, TypeCode typecode);
  280. /**
  281. * Insert the CORBA <code>Value</code> into this <code>Any</code>.
  282. *
  283. * The type of the Any should be set (by {@link #type(TypeCode)})
  284. * before inserting the value.
  285. */
  286. public abstract void insert_Value(Serializable x);
  287. /**
  288. * Insert the CORBA <code>any</code> into this <code>Any</code>
  289. */
  290. public abstract void insert_any(Any x);
  291. /**
  292. * Insert the CORBA <code>boolean</code> into this <code>Any</code>
  293. */
  294. public abstract void insert_boolean(boolean x);
  295. /**
  296. * Insert the CORBA <code>char</code> into this <code>Any</code>
  297. */
  298. public abstract void insert_char(char x);
  299. /**
  300. * Insert the CORBA <code>double</code> into this <code>Any</code>
  301. */
  302. public abstract void insert_double(double x);
  303. /**
  304. * Insert the CORBA <code>fixed</code> into this <code>Any</code>
  305. */
  306. public void insert_fixed(java.math.BigDecimal x, TypeCode typecode)
  307. {
  308. throw new NO_IMPLEMENT();
  309. }
  310. /**
  311. * Insert the CORBA <code>fixed</code> into this <code>Any</code>
  312. */
  313. public void insert_fixed(java.math.BigDecimal x)
  314. {
  315. throw new NO_IMPLEMENT();
  316. }
  317. /**
  318. * Insert the CORBA <code>float</code> into this <code>Any</code>
  319. */
  320. public abstract void insert_float(float x);
  321. /**
  322. * Insert the CORBA <code>long</code> into this <code>Any</code>
  323. */
  324. public abstract void insert_long(int x);
  325. /**
  326. * Insert the CORBA <code>longlong</code> into this <code>Any</code>
  327. */
  328. public abstract void insert_longlong(long x);
  329. /**
  330. * Insert the CORBA <code>octet</code> into this <code>Any</code>
  331. */
  332. public abstract void insert_octet(byte x);
  333. /**
  334. * Insert the CORBA <code>short</code> into this <code>Any</code>
  335. */
  336. public abstract void insert_short(short x);
  337. /**
  338. * Insert the CORBA <code>string</code> into this <code>Any</code>
  339. */
  340. public abstract void insert_string(String x);
  341. /**
  342. * Insert the CORBA <code>ulong</code> into this <code>Any</code>
  343. */
  344. public abstract void insert_ulong(int x);
  345. /**
  346. * Insert the CORBA <code>ulonglong</code> into this <code>Any</code>
  347. */
  348. public abstract void insert_ulonglong(long x);
  349. /**
  350. * Insert the CORBA <code>ushort</code> into this <code>Any</code>
  351. */
  352. public abstract void insert_ushort(short x);
  353. /**
  354. * Insert the CORBA <code>wchar</code> into this <code>Any</code>
  355. */
  356. public abstract void insert_wchar(char x);
  357. /**
  358. * Insert the CORBA <code>wstring</code> into this <code>Any</code>
  359. */
  360. public abstract void insert_wstring(String x);
  361. /**
  362. * Read the value into this <code>Any</code> from the given input stream.
  363. *
  364. * @param input a CORBA stream to read from.
  365. * @param type a TypeCode of the object being read.
  366. *
  367. * @throws org.omg.CORBA.MARSHAL if the given TypeCode does not match
  368. * the TypeCode of the object, found in the stream.
  369. */
  370. public abstract void read_value(org.omg.CORBA.portable.InputStream input,
  371. TypeCode type
  372. )
  373. throws MARSHAL;
  374. /**
  375. * Set the type of the object, stored in this <code>Any</code>, to the
  376. * given TypeCode. Clear the value.
  377. *
  378. * @param valueTypeCode the type of the object that is expected to be stored
  379. * in this <code>any</code>.
  380. */
  381. public abstract void type(TypeCode valueTypeCode);
  382. /**
  383. * Returns the TypeCode of the object, stored in this <code>Any</code>
  384. * @return the TypeCode
  385. */
  386. public abstract TypeCode type();
  387. /**
  388. * Writes out the value (without the typecode of the value), stored in
  389. * this <code>Any</code>.
  390. *
  391. * @param output the CORBA stream to write into.
  392. *
  393. * @throws NullPointerException if the value of this <code>Any</code>
  394. * has not been set.
  395. */
  396. public abstract void write_value(org.omg.CORBA.portable.OutputStream output);
  397. }