1. package org.omg.DynamicAny;
  2. /**
  3. * org/omg/DynamicAny/DynAnyFactoryOperations.java .
  4. * Generated by the IDL-to-Java compiler (portable), version "3.1"
  5. * from ../../../../src/share/classes/org/omg/DynamicAny/DynamicAny.idl
  6. * Monday, February 23, 2004 7:03:09 AM GMT
  7. */
  8. /**
  9. * DynAny objects can be created by invoking operations on the DynAnyFactory object.
  10. * Generally there are only two ways to create a DynAny object:
  11. * <UL>
  12. * <LI>invoking an operation on an existing DynAny object
  13. * <LI>invoking an operation on a DynAnyFactory object
  14. * </UL>
  15. * A constructed DynAny object supports operations that enable the creation of new DynAny
  16. * objects encapsulating access to the value of some constituent.
  17. * DynAny objects also support the copy operation for creating new DynAny objects.
  18. * A reference to the DynAnyFactory object is obtained by calling ORB.resolve_initial_references()
  19. * with the identifier parameter set to the string constant "DynAnyFactory".
  20. * <P>Dynamic interpretation of an any usually involves creating a DynAny object using create_dyn_any()
  21. * as the first step. Depending on the type of the any, the resulting DynAny object reference can be narrowed
  22. * to a DynFixed, DynStruct, DynSequence, DynArray, DynUnion, DynEnum, or DynValue object reference.
  23. * <P>Dynamic creation of an any involves creating a DynAny object using create_dyn_any_from_type_code(),
  24. * passing the TypeCode associated with the value to be created. The returned reference is narrowed to one of
  25. * the complex types, such as DynStruct, if appropriate. Then, the value can be initialized by means of
  26. * invoking operations on the resulting object. Finally, the to_any operation can be invoked
  27. * to create an any value from the constructed DynAny.
  28. */
  29. public interface DynAnyFactoryOperations
  30. {
  31. /**
  32. * Creates a new DynAny object from an any value.
  33. * A copy of the TypeCode associated with the any value is assigned to the resulting DynAny object.
  34. * The value associated with the DynAny object is a copy of the value in the original any.
  35. * The current position of the created DynAny is set to zero if the passed value has components,
  36. * to -1 otherwise
  37. *
  38. * @exception InconsistentTypeCode if value has a TypeCode with a TCKind of tk_Principal,
  39. * tk_native, or tk_abstract_interface
  40. */
  41. org.omg.DynamicAny.DynAny create_dyn_any (org.omg.CORBA.Any value) throws org.omg.DynamicAny.DynAnyFactoryPackage.InconsistentTypeCode;
  42. /**
  43. * Creates a DynAny from a TypeCode. Depending on the TypeCode, the created object may be of type DynAny,
  44. * or one of its derived types, such as DynStruct. The returned reference can be narrowed to the derived type.
  45. * In all cases, a DynAny constructed from a TypeCode has an initial default value.
  46. * The default values of basic types are:
  47. * <UL>
  48. * <LI>false for boolean
  49. * <LI>zero for numeric types
  50. * <LI>zero for types octet, char, and wchar
  51. * <LI>the empty string for string and wstring
  52. * <LI>null for object references
  53. * <LI>a type code with a TCKind value of tk_null for type codes
  54. * <LI>for any values, an any containing a type code with a TCKind value of tk_null type and no value
  55. * </UL>
  56. * For complex types, creation of the corresponding DynAny assigns a default value as follows:
  57. * <UL>
  58. * <LI>For DynSequence it sets the current position to -1 and creates an empty sequence.
  59. * <LI>For DynEnum it sets the current position to -1 and sets the value of the enumerator
  60. * to the first enumerator value indicated by the TypeCode.
  61. * <LI>For DynFixed it sets the current position to -1 and sets the value zero.
  62. * <LI>For DynStruct it sets the current position to -1 for empty exceptions
  63. * and to zero for all other TypeCodes. The members (if any) are (recursively) initialized
  64. * to their default values.
  65. * <LI>For DynArray sets the current position to zero and (recursively) initializes elements
  66. * to their default value.
  67. * <LI>For DynUnion sets the current position to zero. The discriminator value is set
  68. * to a value consistent with the first named member of the union. That member is activated and (recursively)
  69. * initialized to its default value.
  70. * <LI>For DynValue and DynValueBox it initializes to a null value.
  71. * </UL>
  72. */
  73. org.omg.DynamicAny.DynAny create_dyn_any_from_type_code (org.omg.CORBA.TypeCode type) throws org.omg.DynamicAny.DynAnyFactoryPackage.InconsistentTypeCode;
  74. } // interface DynAnyFactoryOperations