KickJava   Java API By Example, From Geeks To Geeks.

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


1 package org.omg.DynamicAny;
2
3
4 /**
5 * org/omg/DynamicAny/DynAnyFactoryHelper.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     * DynAny objects can be created by invoking operations on the DynAnyFactory object.
14     * Generally there are only two ways to create a DynAny object:
15     * <UL>
16     * <LI>invoking an operation on an existing DynAny object
17     * <LI>invoking an operation on a DynAnyFactory object
18     * </UL>
19     * A constructed DynAny object supports operations that enable the creation of new DynAny
20     * objects encapsulating access to the value of some constituent.
21     * DynAny objects also support the copy operation for creating new DynAny objects.
22     * A reference to the DynAnyFactory object is obtained by calling ORB.resolve_initial_references()
23     * with the identifier parameter set to the string constant "DynAnyFactory".
24     * <P>Dynamic interpretation of an any usually involves creating a DynAny object using create_dyn_any()
25     * as the first step. Depending on the type of the any, the resulting DynAny object reference can be narrowed
26     * to a DynFixed, DynStruct, DynSequence, DynArray, DynUnion, DynEnum, or DynValue object reference.
27     * <P>Dynamic creation of an any involves creating a DynAny object using create_dyn_any_from_type_code(),
28     * passing the TypeCode associated with the value to be created. The returned reference is narrowed to one of
29     * the complex types, such as DynStruct, if appropriate. Then, the value can be initialized by means of
30     * invoking operations on the resulting object. Finally, the to_any operation can be invoked
31     * to create an any value from the constructed DynAny.
32     */

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