1. package org.omg.DynamicAny;
  2. /**
  3. * org/omg/DynamicAny/DynValueHelper.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. * DynValue objects support the manipulation of IDL non-boxed value types.
  10. * The DynValue interface can represent both null and non-null value types.
  11. * For a DynValue representing a non-null value type, the DynValue's components comprise
  12. * the public and private members of the value type, including those inherited from concrete base value types,
  13. * in the order of definition. A DynValue representing a null value type has no components
  14. * and a current position of -1.
  15. * <P>Warning: Indiscriminantly changing the contents of private value type members can cause the value type
  16. * implementation to break by violating internal constraints. Access to private members is provided to support
  17. * such activities as ORB bridging and debugging and should not be used to arbitrarily violate
  18. * the encapsulation of the value type.
  19. */
  20. abstract public class DynValueHelper
  21. {
  22. private static String _id = "IDL:omg.org/DynamicAny/DynValue:1.0";
  23. public static void insert (org.omg.CORBA.Any a, org.omg.DynamicAny.DynValue that)
  24. {
  25. org.omg.CORBA.portable.OutputStream out = a.create_output_stream ();
  26. a.type (type ());
  27. write (out, that);
  28. a.read_value (out.create_input_stream (), type ());
  29. }
  30. public static org.omg.DynamicAny.DynValue extract (org.omg.CORBA.Any a)
  31. {
  32. return read (a.create_input_stream ());
  33. }
  34. private static org.omg.CORBA.TypeCode __typeCode = null;
  35. synchronized public static org.omg.CORBA.TypeCode type ()
  36. {
  37. if (__typeCode == null)
  38. {
  39. __typeCode = org.omg.CORBA.ORB.init ().create_interface_tc (org.omg.DynamicAny.DynValueHelper.id (), "DynValue");
  40. }
  41. return __typeCode;
  42. }
  43. public static String id ()
  44. {
  45. return _id;
  46. }
  47. public static org.omg.DynamicAny.DynValue read (org.omg.CORBA.portable.InputStream istream)
  48. {
  49. throw new org.omg.CORBA.MARSHAL ();
  50. }
  51. public static void write (org.omg.CORBA.portable.OutputStream ostream, org.omg.DynamicAny.DynValue value)
  52. {
  53. throw new org.omg.CORBA.MARSHAL ();
  54. }
  55. public static org.omg.DynamicAny.DynValue narrow (org.omg.CORBA.Object obj)
  56. {
  57. if (obj == null)
  58. return null;
  59. else if (obj instanceof org.omg.DynamicAny.DynValue)
  60. return (org.omg.DynamicAny.DynValue)obj;
  61. else if (!obj._is_a (id ()))
  62. throw new org.omg.CORBA.BAD_PARAM ();
  63. else
  64. {
  65. org.omg.CORBA.portable.Delegate delegate = ((org.omg.CORBA.portable.ObjectImpl)obj)._get_delegate ();
  66. org.omg.DynamicAny._DynValueStub stub = new org.omg.DynamicAny._DynValueStub ();
  67. stub._set_delegate(delegate);
  68. return stub;
  69. }
  70. }
  71. public static org.omg.DynamicAny.DynValue unchecked_narrow (org.omg.CORBA.Object obj)
  72. {
  73. if (obj == null)
  74. return null;
  75. else if (obj instanceof org.omg.DynamicAny.DynValue)
  76. return (org.omg.DynamicAny.DynValue)obj;
  77. else
  78. {
  79. org.omg.CORBA.portable.Delegate delegate = ((org.omg.CORBA.portable.ObjectImpl)obj)._get_delegate ();
  80. org.omg.DynamicAny._DynValueStub stub = new org.omg.DynamicAny._DynValueStub ();
  81. stub._set_delegate(delegate);
  82. return stub;
  83. }
  84. }
  85. }