1. package org.omg.DynamicAny;
  2. /**
  3. * org/omg/DynamicAny/DynAnyFactoryHelper.java .
  4. * Generated by the IDL-to-Java compiler (portable), version "3.2"
  5. * from ../../../../src/share/classes/org/omg/DynamicAny/DynamicAny.idl
  6. * Wednesday, September 15, 2004 10:28:50 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. abstract public class DynAnyFactoryHelper
  30. {
  31. private static String _id = "IDL:omg.org/DynamicAny/DynAnyFactory:1.0";
  32. public static void insert (org.omg.CORBA.Any a, org.omg.DynamicAny.DynAnyFactory that)
  33. {
  34. org.omg.CORBA.portable.OutputStream out = a.create_output_stream ();
  35. a.type (type ());
  36. write (out, that);
  37. a.read_value (out.create_input_stream (), type ());
  38. }
  39. public static org.omg.DynamicAny.DynAnyFactory extract (org.omg.CORBA.Any a)
  40. {
  41. return read (a.create_input_stream ());
  42. }
  43. private static org.omg.CORBA.TypeCode __typeCode = null;
  44. synchronized public static org.omg.CORBA.TypeCode type ()
  45. {
  46. if (__typeCode == null)
  47. {
  48. __typeCode = org.omg.CORBA.ORB.init ().create_interface_tc (org.omg.DynamicAny.DynAnyFactoryHelper.id (), "DynAnyFactory");
  49. }
  50. return __typeCode;
  51. }
  52. public static String id ()
  53. {
  54. return _id;
  55. }
  56. public static org.omg.DynamicAny.DynAnyFactory read (org.omg.CORBA.portable.InputStream istream)
  57. {
  58. throw new org.omg.CORBA.MARSHAL ();
  59. }
  60. public static void write (org.omg.CORBA.portable.OutputStream ostream, org.omg.DynamicAny.DynAnyFactory value)
  61. {
  62. throw new org.omg.CORBA.MARSHAL ();
  63. }
  64. public static org.omg.DynamicAny.DynAnyFactory narrow (org.omg.CORBA.Object obj)
  65. {
  66. if (obj == null)
  67. return null;
  68. else if (obj instanceof org.omg.DynamicAny.DynAnyFactory)
  69. return (org.omg.DynamicAny.DynAnyFactory)obj;
  70. else if (!obj._is_a (id ()))
  71. throw new org.omg.CORBA.BAD_PARAM ();
  72. else
  73. {
  74. org.omg.CORBA.portable.Delegate delegate = ((org.omg.CORBA.portable.ObjectImpl)obj)._get_delegate ();
  75. org.omg.DynamicAny._DynAnyFactoryStub stub = new org.omg.DynamicAny._DynAnyFactoryStub ();
  76. stub._set_delegate(delegate);
  77. return stub;
  78. }
  79. }
  80. public static org.omg.DynamicAny.DynAnyFactory unchecked_narrow (org.omg.CORBA.Object obj)
  81. {
  82. if (obj == null)
  83. return null;
  84. else if (obj instanceof org.omg.DynamicAny.DynAnyFactory)
  85. return (org.omg.DynamicAny.DynAnyFactory)obj;
  86. else
  87. {
  88. org.omg.CORBA.portable.Delegate delegate = ((org.omg.CORBA.portable.ObjectImpl)obj)._get_delegate ();
  89. org.omg.DynamicAny._DynAnyFactoryStub stub = new org.omg.DynamicAny._DynAnyFactoryStub ();
  90. stub._set_delegate(delegate);
  91. return stub;
  92. }
  93. }
  94. }