KickJava   Java API By Example, From Geeks To Geeks.

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


1 /*
2  * @(#)IDLTypeHelper.java 1.10 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 package org.omg.CORBA;
8
9
10 /**
11 * The Helper for <tt>IDLType</tt>. For more information on
12 * Helper files, see <a HREF="doc-files/generatedfiles.html#helper">
13 * "Generated Files: Helper Files"</a>.<P>
14 * org/omg/CORBA/IDLTypeHelper.java
15 * Generated by the IDL-to-Java compiler (portable), version "3.0"
16 * from ir.idl
17 * 03 June 1999 11:33:44 o'clock GMT+00:00
18 */

19
20 abstract public class IDLTypeHelper
21 {
22   private static String JavaDoc _id = "IDL:omg.org/CORBA/IDLType:1.0";
23
24   public static void insert (org.omg.CORBA.Any JavaDoc a, org.omg.CORBA.IDLType JavaDoc that)
25   {
26     org.omg.CORBA.portable.OutputStream JavaDoc out = a.create_output_stream ();
27     a.type (type ());
28     write (out, that);
29     a.read_value (out.create_input_stream (), type ());
30   }
31
32   public static org.omg.CORBA.IDLType JavaDoc extract (org.omg.CORBA.Any JavaDoc a)
33   {
34     return read (a.create_input_stream ());
35   }
36
37   private static org.omg.CORBA.TypeCode JavaDoc __typeCode = null;
38   synchronized public static org.omg.CORBA.TypeCode JavaDoc type ()
39   {
40     if (__typeCode == null)
41     {
42       __typeCode = org.omg.CORBA.ORB.init ().create_interface_tc (org.omg.CORBA.IDLTypeHelper.id (), "IDLType");
43     }
44     return __typeCode;
45   }
46
47   public static String JavaDoc id ()
48   {
49     return _id;
50   }
51
52   public static org.omg.CORBA.IDLType JavaDoc read (org.omg.CORBA.portable.InputStream JavaDoc istream)
53   {
54     return narrow (istream.read_Object (_IDLTypeStub JavaDoc.class));
55   }
56
57   public static void write (org.omg.CORBA.portable.OutputStream JavaDoc ostream, org.omg.CORBA.IDLType JavaDoc value)
58   {
59     ostream.write_Object ((org.omg.CORBA.Object JavaDoc) value);
60   }
61
62   public static org.omg.CORBA.IDLType JavaDoc narrow (org.omg.CORBA.Object JavaDoc obj)
63   {
64     if (obj == null)
65       return null;
66     else if (obj instanceof org.omg.CORBA.IDLType JavaDoc)
67       return (org.omg.CORBA.IDLType JavaDoc)obj;
68     else if (!obj._is_a (id ()))
69       throw new org.omg.CORBA.BAD_PARAM JavaDoc ();
70     else
71     {
72       org.omg.CORBA.portable.Delegate JavaDoc delegate = ((org.omg.CORBA.portable.ObjectImpl JavaDoc)obj)._get_delegate ();
73       return new org.omg.CORBA._IDLTypeStub JavaDoc (delegate);
74     }
75   }
76
77 }
78
Popular Tags