KickJava   Java API By Example, From Geeks To Geeks.

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


1 /*
2  * @(#)StringValueHelper.java 1.14 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 /*
8  * Licensed Materials - Property of IBM
9  * RMI-IIOP v1.0
10  * Copyright IBM Corp. 1998 1999 All Rights Reserved
11  *
12  * US Government Users Restricted Rights - Use, duplication or
13  * disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
14  */

15
16 package org.omg.CORBA;
17
18 /**
19 * The Helper for <tt>StringValue</tt>. For more information on
20 * Helper files, see <a HREF="doc-files/generatedfiles.html#helper">
21 * "Generated Files: Helper Files"</a>.<P>
22 * org/omg/CORBA/StringValueHelper.java
23 * Generated by the IDL-to-Java compiler (portable), version "3.0"
24 * from orb.idl
25 * 31 May 1999 22:27:30 o'clock GMT+00:00
26 *
27 * The class definition has been modified to conform to the following
28 * OMG specifications :
29 * <ul>
30 * <li> ORB core as defined by CORBA 2.3.1
31 * (<a HREF="http://cgi.omg.org/cgi-bin/doc?formal/99-10-07">formal/99-10-07</a>)
32 * </li>
33 *
34 * <li> IDL/Java Language Mapping as defined in
35 * <a HREF="http://cgi.omg.org/cgi-bin/doc?ptc/00-01-08">ptc/00-01-08</a>
36 * </li>
37 * </ul>
38 */

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