KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > omg > CORBA > WStringValueHelper


1 /*
2  * @(#)WStringValueHelper.java 1.15 03/12/19
3  *
4  * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
5  * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
6  */

7 /* @(#)WStringValueHelper.java 1.15 03/12/19 */
8
9 /**
10 * The Helper for <tt>WStringValue</tt>. For more information on
11 * Helper files, see <a HREF="doc-files/generatedfiles.html#helper">
12 * "Generated Files: Helper Files"</a>.<P>
13 */

14
15 /*
16  * Licensed Materials - Property of IBM
17  * RMI-IIOP v1.0
18  * Copyright IBM Corp. 1998 1999 All Rights Reserved
19  *
20  * US Government Users Restricted Rights - Use, duplication or
21  * disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
22  */

23
24 package org.omg.CORBA;
25
26 /**
27 * org/omg/CORBA/WStringValueHelper.java
28 * Generated by the IDL-to-Java compiler (portable), version "3.0"
29 * from orb.idl
30 * 31 May 1999 22:27:30 o'clock GMT+00:00
31 *
32 * The class definition has been modified to conform to the following
33 * OMG specifications :
34 * <ul>
35 * <li> ORB core as defined by CORBA 2.3.1
36 * (<a HREF="http://cgi.omg.org/cgi-bin/doc?formal/99-10-07">formal/99-10-07</a>)
37 * </li>
38 *
39 * <li> IDL/Java Language Mapping as defined in
40 * <a HREF="http://cgi.omg.org/cgi-bin/doc?ptc/00-01-08">ptc/00-01-08</a>
41 * </li>
42 * </ul>
43 */

44
45 public class WStringValueHelper implements org.omg.CORBA.portable.BoxedValueHelper JavaDoc
46 {
47     private static String JavaDoc _id = "IDL:omg.org/CORBA/WStringValue:1.0";
48
49   private static WStringValueHelper JavaDoc _instance = new WStringValueHelper JavaDoc ();
50
51     public static void insert (org.omg.CORBA.Any JavaDoc a, String JavaDoc that)
52     {
53     org.omg.CORBA.portable.OutputStream JavaDoc out = a.create_output_stream ();
54     a.type (type ());
55     write (out, that);
56     a.read_value (out.create_input_stream (), type ());
57     }
58
59     public static String JavaDoc extract (org.omg.CORBA.Any JavaDoc a)
60     {
61     return read (a.create_input_stream ());
62     }
63
64     private static org.omg.CORBA.TypeCode JavaDoc __typeCode = null;
65     private static boolean __active = false;
66     synchronized public static org.omg.CORBA.TypeCode JavaDoc type ()
67     {
68     if (__typeCode == null)
69         {
70         synchronized (org.omg.CORBA.TypeCode JavaDoc.class)
71             {
72             if (__typeCode == null)
73                 {
74                 if (__active)
75                     {
76                     return org.omg.CORBA.ORB.init().create_recursive_tc ( _id );
77                     }
78                 __active = true;
79                 __typeCode = org.omg.CORBA.ORB.init ().create_wstring_tc (0);
80                 __typeCode = org.omg.CORBA.ORB.init ().create_value_box_tc (_id, "WStringValue", __typeCode);
81                 __active = false;
82                 }
83             }
84         }
85     return __typeCode;
86     }
87
88     public static String JavaDoc id ()
89     {
90     return _id;
91     }
92
93     public static String JavaDoc read (org.omg.CORBA.portable.InputStream JavaDoc istream)
94     {
95     if (!(istream instanceof org.omg.CORBA_2_3.portable.InputStream JavaDoc)) {
96       throw new org.omg.CORBA.BAD_PARAM JavaDoc(); }
97     return (String JavaDoc) ((org.omg.CORBA_2_3.portable.InputStream JavaDoc) istream).read_value (_instance);
98     }
99
100   public java.io.Serializable JavaDoc read_value (org.omg.CORBA.portable.InputStream JavaDoc istream)
101     {
102     String JavaDoc tmp;
103     tmp = istream.read_wstring ();
104     return (java.io.Serializable JavaDoc) tmp;
105     }
106
107   public static void write (org.omg.CORBA.portable.OutputStream JavaDoc ostream, String JavaDoc value)
108     {
109     if (!(ostream instanceof org.omg.CORBA_2_3.portable.OutputStream JavaDoc)) {
110       throw new org.omg.CORBA.BAD_PARAM JavaDoc(); }
111     ((org.omg.CORBA_2_3.portable.OutputStream JavaDoc) ostream).write_value (value, _instance);
112     }
113
114     public void write_value (org.omg.CORBA.portable.OutputStream JavaDoc ostream, java.io.Serializable JavaDoc value)
115     {
116     if (!(value instanceof String JavaDoc)) {
117       throw new org.omg.CORBA.MARSHAL JavaDoc(); }
118     String JavaDoc valueType = (String JavaDoc) value;
119     ostream.write_wstring (valueType);
120     }
121
122     public String JavaDoc get_id ()
123     {
124     return _id;
125     }
126
127 }
128
Popular Tags