KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > omg > DynamicAny > DynUnionHelper


1 package org.omg.DynamicAny;
2
3
4 /**
5 * org/omg/DynamicAny/DynUnionHelper.java .
6 * Generated by the IDL-to-Java compiler (portable), version "3.2"
7 * from ../../../../src/share/classes/org/omg/DynamicAny/DynamicAny.idl
8 * Saturday, February 9, 2008 9:40:12 AM GMT
9 */

10
11
12 /**
13     * DynUnion objects support the manipulation of IDL unions.
14     * A union can have only two valid current positions:
15     * <UL>
16     * <LI>zero, which denotes the discriminator
17     * <LI>one, which denotes the active member
18     * </UL>
19     * The component_count value for a union depends on the current discriminator:
20     * it is 2 for a union whose discriminator indicates a named member, and 1 otherwise.
21     */

22 abstract public class DynUnionHelper
23 {
24   private static String JavaDoc _id = "IDL:omg.org/DynamicAny/DynUnion:1.0";
25
26   public static void insert (org.omg.CORBA.Any JavaDoc a, org.omg.DynamicAny.DynUnion JavaDoc that)
27   {
28     org.omg.CORBA.portable.OutputStream JavaDoc out = a.create_output_stream ();
29     a.type (type ());
30     write (out, that);
31     a.read_value (out.create_input_stream (), type ());
32   }
33
34   public static org.omg.DynamicAny.DynUnion JavaDoc extract (org.omg.CORBA.Any JavaDoc a)
35   {
36     return read (a.create_input_stream ());
37   }
38
39   private static org.omg.CORBA.TypeCode JavaDoc __typeCode = null;
40   synchronized public static org.omg.CORBA.TypeCode JavaDoc type ()
41   {
42     if (__typeCode == null)
43     {
44       __typeCode = org.omg.CORBA.ORB.init ().create_interface_tc (org.omg.DynamicAny.DynUnionHelper.id (), "DynUnion");
45     }
46     return __typeCode;
47   }
48
49   public static String JavaDoc id ()
50   {
51     return _id;
52   }
53
54   public static org.omg.DynamicAny.DynUnion JavaDoc read (org.omg.CORBA.portable.InputStream JavaDoc istream)
55   {
56       throw new org.omg.CORBA.MARSHAL JavaDoc ();
57   }
58
59   public static void write (org.omg.CORBA.portable.OutputStream JavaDoc ostream, org.omg.DynamicAny.DynUnion JavaDoc value)
60   {
61       throw new org.omg.CORBA.MARSHAL JavaDoc ();
62   }
63
64   public static org.omg.DynamicAny.DynUnion JavaDoc narrow (org.omg.CORBA.Object JavaDoc obj)
65   {
66     if (obj == null)
67       return null;
68     else if (obj instanceof org.omg.DynamicAny.DynUnion JavaDoc)
69       return (org.omg.DynamicAny.DynUnion JavaDoc)obj;
70     else if (!obj._is_a (id ()))
71       throw new org.omg.CORBA.BAD_PARAM JavaDoc ();
72     else
73     {
74       org.omg.CORBA.portable.Delegate JavaDoc delegate = ((org.omg.CORBA.portable.ObjectImpl JavaDoc)obj)._get_delegate ();
75       org.omg.DynamicAny._DynUnionStub JavaDoc stub = new org.omg.DynamicAny._DynUnionStub JavaDoc ();
76       stub._set_delegate(delegate);
77       return stub;
78     }
79   }
80
81   public static org.omg.DynamicAny.DynUnion JavaDoc unchecked_narrow (org.omg.CORBA.Object JavaDoc obj)
82   {
83     if (obj == null)
84       return null;
85     else if (obj instanceof org.omg.DynamicAny.DynUnion JavaDoc)
86       return (org.omg.DynamicAny.DynUnion JavaDoc)obj;
87     else
88     {
89       org.omg.CORBA.portable.Delegate JavaDoc delegate = ((org.omg.CORBA.portable.ObjectImpl JavaDoc)obj)._get_delegate ();
90       org.omg.DynamicAny._DynUnionStub JavaDoc stub = new org.omg.DynamicAny._DynUnionStub JavaDoc ();
91       stub._set_delegate(delegate);
92       return stub;
93     }
94   }
95
96 }
97
Popular Tags