DynAnyFactoryOperations.java 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155
  1. /* DynAnyFactoryOperations.java --
  2. Copyright (C) 2005, 2006 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.DynamicAny;
  32. import org.omg.CORBA.Any;
  33. import org.omg.CORBA.TCKind;
  34. import org.omg.CORBA.TypeCode;
  35. import org.omg.DynamicAny.DynAnyFactoryPackage.InconsistentTypeCode;
  36. /**
  37. * Defines the operations, applicable for DynAnyFactory. These operations
  38. * produce new DynAny's either from Any, serving as a template and value
  39. * provider, or from the given typecode.
  40. *
  41. * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org)
  42. */
  43. public interface DynAnyFactoryOperations
  44. {
  45. /**
  46. * Create DynAny for holding the data of the given type. The returned DynAny
  47. * is initialised to its agreed default value. The agreed default values are:
  48. * <table border='1'>
  49. * <tr>
  50. * <th>Type</th>
  51. * <th>Value</th>
  52. * <th>Creates</th>
  53. * </tr>
  54. *
  55. * <tr>
  56. * <td>boolean</td>
  57. * <td>false</td>
  58. * <td>{@link DynAny}</td>
  59. * </tr>
  60. * <tr>
  61. * <td>numeric types, octet, fixed</td>
  62. * <td>0</td>
  63. * <td>{@link DynAny}</td>
  64. * </tr>
  65. * <tr>
  66. * <td>char, wchar</td>
  67. * <td>(char) 0</td>
  68. * <td>{@link DynAny}</td>
  69. * </tr>
  70. * <tr>
  71. * <td>string, wstring</td>
  72. * <td>empty string ("", not <code>null<code>)</td>
  73. * <td>{@link DynAny}</td>
  74. * </tr>
  75. * <tr>
  76. * <td>{@link Any}</td>
  77. * <td>{@link Any} with no value and typecode of kind {@link TCKind#tk_null}</td>
  78. * <td>{@link DynAny}</td>
  79. * </tr>
  80. * <tr>
  81. * <td>Sequence</td>
  82. * <td>Empty (zero size) sequence</td>
  83. * <td>{@link DynSequence}</td>
  84. * </tr>
  85. * <tr>
  86. * <td>Array</td>
  87. * <td>All members of array are recursively initialised to default values.</td>
  88. * <td>{@link DynArray}</td>
  89. * </tr>
  90. * <tr>
  91. * <td>Structure, exception</td>
  92. * <td>All fields of the structure (if any) are recursively initialised to
  93. * default values.</td>
  94. * <td>{@link DynStruct}</td>
  95. * </tr>
  96. * <tr>
  97. * <td>Enumeration</td>
  98. * <td>Default value, indicated by typecode.</td>
  99. * <td>{@link DynEnum}</td>
  100. * </tr>
  101. * <tr>
  102. * <td>Union</td>
  103. * <td>Default variant (indicated by typecode), recursively initialised to
  104. * its default value.</td>
  105. * <td>{@link DynUnion}</td>
  106. * </tr>
  107. * <tr>
  108. * <td>Value, ValueBox</td>
  109. * <td>null</td>
  110. * <td>{@link DynValue}, {@link DynValueBox}</td>
  111. * </tr>
  112. * <tr>
  113. * <td>TypeCode</td>
  114. * <td>Typecode of kind <code>TCKind.tk_null</code></td>
  115. * <td>{@link DynValue}, {@link DynValueBox}</td>
  116. * </tr>
  117. *
  118. * </table>
  119. *
  120. * @param type the type of the data being stored.
  121. *
  122. * @return the created DynAny, having the passed type.
  123. *
  124. * @throws InconsistentTypeCode if type.kind() is tk_Principal, tk_native or
  125. * tk_abstract_interface. These types cannot be stored in DynAny.
  126. */
  127. DynAny create_dyn_any_from_type_code(TypeCode type)
  128. throws InconsistentTypeCode;
  129. /**
  130. * Create DynAny using the given Any as template.
  131. *
  132. * @param value the Any, providing type and value for the DynAny being
  133. * created.
  134. *
  135. * @return the created DynAny, having the same type and storing the same value
  136. * as the passed Any.
  137. *
  138. * @throws InconsistentTypeCode if value.type().kind() is tk_Principal,
  139. * tk_native or tk_abstract_interface. These types cannot be stored in DynAny.
  140. */
  141. DynAny create_dyn_any(Any value)
  142. throws InconsistentTypeCode;
  143. }