1 7 15 16 package org.omg.CORBA; 17 18 39 40 public class StringValueHelper implements org.omg.CORBA.portable.BoxedValueHelper 41 { 42 private static String _id = "IDL:omg.org/CORBA/StringValue:1.0"; 43 44 private static StringValueHelper _instance = new StringValueHelper (); 45 46 public static void insert (org.omg.CORBA.Any a, String that) 47 { 48 org.omg.CORBA.portable.OutputStream 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 extract (org.omg.CORBA.Any a) 55 { 56 return read (a.create_input_stream ()); 57 } 58 59 private static org.omg.CORBA.TypeCode __typeCode = null; 60 private static boolean __active = false; 61 synchronized public static org.omg.CORBA.TypeCode type () 62 { 63 if (__typeCode == null) 64 { 65 synchronized (org.omg.CORBA.TypeCode .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 id () 84 { 85 return _id; 86 } 87 88 public static String read (org.omg.CORBA.portable.InputStream istream) 89 { 90 if (!(istream instanceof org.omg.CORBA_2_3.portable.InputStream )) { 91 throw new org.omg.CORBA.BAD_PARAM (); } 92 return (String ) ((org.omg.CORBA_2_3.portable.InputStream ) istream).read_value (_instance); 93 } 94 95 public java.io.Serializable read_value (org.omg.CORBA.portable.InputStream istream) 96 { 97 String tmp; 98 tmp = istream.read_string (); 99 return (java.io.Serializable ) tmp; 100 } 101 102 public static void write (org.omg.CORBA.portable.OutputStream ostream, String value) 103 { 104 if (!(ostream instanceof org.omg.CORBA_2_3.portable.OutputStream )) { 105 throw new org.omg.CORBA.BAD_PARAM (); } 106 ((org.omg.CORBA_2_3.portable.OutputStream ) ostream).write_value (value, _instance); 107 } 108 109 public void write_value (org.omg.CORBA.portable.OutputStream ostream, java.io.Serializable value) 110 { 111 if (!(value instanceof String )) { 112 throw new org.omg.CORBA.MARSHAL (); } 113 String valueType = (String ) value; 114 ostream.write_string (valueType); 115 } 116 117 public String get_id () 118 { 119 return _id; 120 } 121 122 } 123 | Popular Tags |