KickJava   Java API By Example, From Geeks To Geeks.

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


1 /*
2  * @(#)TypeCodeHolder.java 1.32 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 package org.omg.CORBA;
9
10 import org.omg.CORBA.portable.Streamable JavaDoc;
11 import org.omg.CORBA.portable.InputStream JavaDoc;
12 import org.omg.CORBA.portable.OutputStream JavaDoc;
13
14 /**
15  * The Holder for <tt>TypeCode</tt>. For more information on
16  * Holder files, see <a HREF="doc-files/generatedfiles.html#holder">
17  * "Generated Files: Holder Files"</a>.<P>
18  * A Holder class for a <code>TypeCode</code> object
19  * that is used to store "out" and "inout" parameters in IDL operations.
20  * If an IDL operation signature has an IDL <code>TypeCode</code> as an "out"
21  * or "inout" parameter, the programmer must pass an instance of
22  * <code>TypeCodeHolder</code> as the corresponding
23  * parameter in the method invocation; for "inout" parameters, the programmer
24  * must also fill the "in" value to be sent to the server.
25  * Before the method invocation returns, the ORB will fill in the
26  * value corresponding to the "out" value returned from the server.
27  * <P>
28  * If <code>myTypeCodeHolder</code> is an instance of <code>TypeCodeHolder</code>,
29  * the value stored in its <code>value</code> field can be accessed with
30  * <code>myTypeCodeHolder.value</code>.
31  *
32  * @version 1.14, 09/09/97
33  * @since JDK1.2
34  */

35 public final class TypeCodeHolder implements Streamable JavaDoc {
36
37     /**
38      * The <code>TypeCode</code> value held by
39      * this <code>TypeCodeHolder</code> object.
40      */

41     public TypeCode JavaDoc value;
42
43     /**
44      * Constructs a new <code>TypeCodeHolder</code> object with its
45      * <code>value</code> field initialized to <code>null</code>.
46      */

47     public TypeCodeHolder() {
48     }
49
50     /**
51      * Constructs a new <code>TypeCodeHolder</code> object with its
52      * <code>value</code> field initialized to the given
53      * <code>TypeCode</code> object.
54      * @param initial the <code>TypeCode</code> object with which to initialize
55      * the <code>value</code> field of the newly-created
56      * <code>TypeCodeHolder</code> object
57      */

58     public TypeCodeHolder(TypeCode JavaDoc initial) {
59     value = initial;
60     }
61
62     /**
63      * Reads from <code>input</code> and initalizes the value in
64      * this <code>TypeCodeHolder</code> object
65      * with the unmarshalled data.
66      *
67      * @param input the InputStream containing CDR formatted data from the wire
68      */

69     public void _read(InputStream JavaDoc input) {
70     value = input.read_TypeCode();
71     }
72
73     /**
74      * Marshals to <code>output</code> the value in
75      * this <code>TypeCodeHolder</code> object.
76      *
77      * @param output the OutputStream which will contain the CDR formatted data
78      */

79     public void _write(OutputStream JavaDoc output) {
80     output.write_TypeCode(value);
81     }
82
83     /**
84      * Returns the TypeCode corresponding to the value held in
85      * this <code>TypeCodeHolder</code> object.
86      *
87      * @return the TypeCode of the value held in
88      * this <code>TypeCodeHolder</code> object
89      */

90     public org.omg.CORBA.TypeCode JavaDoc _type() {
91     return ORB.init().get_primitive_tc(TCKind.tk_TypeCode);
92     }
93 }
94
Popular Tags