1. /*
  2. * @(#)WStringValueHelper.java 1.14 03/01/23
  3. *
  4. * Copyright 2003 Sun Microsystems, Inc. All rights reserved.
  5. * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
  6. */
  7. /* @(#)WStringValueHelper.java 1.14 03/01/23 */
  8. /**
  9. * The Helper for <tt>WStringValue</tt>. For more information on
  10. * Helper files, see <a href="doc-files/generatedfiles.html#helper">
  11. * "Generated Files: Helper Files"</a>.<P>
  12. */
  13. /*
  14. * Licensed Materials - Property of IBM
  15. * RMI-IIOP v1.0
  16. * Copyright IBM Corp. 1998 1999 All Rights Reserved
  17. *
  18. * US Government Users Restricted Rights - Use, duplication or
  19. * disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
  20. */
  21. package org.omg.CORBA;
  22. /**
  23. * org/omg/CORBA/WStringValueHelper.java
  24. * Generated by the IDL-to-Java compiler (portable), version "3.0"
  25. * from orb.idl
  26. * 31 May 1999 22:27:30 o'clock GMT+00:00
  27. *
  28. * The class definition has been modified to conform to the following
  29. * OMG specifications :
  30. * <ul>
  31. * <li> ORB core as defined by CORBA 2.3.1
  32. * (<a href="http://cgi.omg.org/cgi-bin/doc?formal/99-10-07">formal/99-10-07</a>)
  33. * </li>
  34. *
  35. * <li> IDL/Java Language Mapping as defined in
  36. * <a href="http://cgi.omg.org/cgi-bin/doc?ptc/00-01-08">ptc/00-01-08</a>
  37. * </li>
  38. * </ul>
  39. */
  40. public class WStringValueHelper implements org.omg.CORBA.portable.BoxedValueHelper
  41. {
  42. private static String _id = "IDL:omg.org/CORBA/WStringValue:1.0";
  43. private static WStringValueHelper _instance = new WStringValueHelper ();
  44. public static void insert (org.omg.CORBA.Any a, String that)
  45. {
  46. org.omg.CORBA.portable.OutputStream out = a.create_output_stream ();
  47. a.type (type ());
  48. write (out, that);
  49. a.read_value (out.create_input_stream (), type ());
  50. }
  51. public static String extract (org.omg.CORBA.Any a)
  52. {
  53. return read (a.create_input_stream ());
  54. }
  55. private static org.omg.CORBA.TypeCode __typeCode = null;
  56. private static boolean __active = false;
  57. synchronized public static org.omg.CORBA.TypeCode type ()
  58. {
  59. if (__typeCode == null)
  60. {
  61. synchronized (org.omg.CORBA.TypeCode.class)
  62. {
  63. if (__typeCode == null)
  64. {
  65. if (__active)
  66. {
  67. return org.omg.CORBA.ORB.init().create_recursive_tc ( _id );
  68. }
  69. __active = true;
  70. __typeCode = org.omg.CORBA.ORB.init ().create_wstring_tc (0);
  71. __typeCode = org.omg.CORBA.ORB.init ().create_value_box_tc (_id, "WStringValue", __typeCode);
  72. __active = false;
  73. }
  74. }
  75. }
  76. return __typeCode;
  77. }
  78. public static String id ()
  79. {
  80. return _id;
  81. }
  82. public static String read (org.omg.CORBA.portable.InputStream istream)
  83. {
  84. if (!(istream instanceof org.omg.CORBA_2_3.portable.InputStream)) {
  85. throw new org.omg.CORBA.BAD_PARAM(); }
  86. return (String) ((org.omg.CORBA_2_3.portable.InputStream) istream).read_value (_instance);
  87. }
  88. public java.io.Serializable read_value (org.omg.CORBA.portable.InputStream istream)
  89. {
  90. String tmp;
  91. tmp = istream.read_wstring ();
  92. return (java.io.Serializable) tmp;
  93. }
  94. public static void write (org.omg.CORBA.portable.OutputStream ostream, String value)
  95. {
  96. if (!(ostream instanceof org.omg.CORBA_2_3.portable.OutputStream)) {
  97. throw new org.omg.CORBA.BAD_PARAM(); }
  98. ((org.omg.CORBA_2_3.portable.OutputStream) ostream).write_value (value, _instance);
  99. }
  100. public void write_value (org.omg.CORBA.portable.OutputStream ostream, java.io.Serializable value)
  101. {
  102. if (!(value instanceof String)) {
  103. throw new org.omg.CORBA.MARSHAL(); }
  104. String valueType = (String) value;
  105. ostream.write_wstring (valueType);
  106. }
  107. public String get_id ()
  108. {
  109. return _id;
  110. }
  111. }