KickJava   Java API By Example, From Geeks To Geeks.

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


1 /*
2  * @(#)ValueBaseHolder.java 1.12 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>ValueBase</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>java.io.Serializable</code>
19  * that is used to store "out" and "inout" parameters in IDL methods.
20  * If an IDL method signature has an IDL <code>ValueBase</code> as an "out"
21  * or "inout" parameter, the programmer must pass an instance of
22  * <code>ValueBaseHolder</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>myValueBaseHolder</code> is an instance of <code>ValueBaseHolder</code>,
29  * the value stored in its <code>value</code> field can be accessed with
30  * <code>myValueBaseHolder.value</code>.
31  *
32  */

33 public final class ValueBaseHolder implements Streamable JavaDoc {
34
35     /**
36      * The <code>java.io.Serializable</code> value held by this
37      * <code>ValueBaseHolder</code> object.
38      */

39     public java.io.Serializable JavaDoc value;
40
41     /**
42      * Constructs a new <code>ValueBaseHolder</code> object with its
43      * <code>value</code> field initialized to <code>0</code>.
44      */

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

56     public ValueBaseHolder(java.io.Serializable JavaDoc initial) {
57     value = initial;
58     }
59
60     /**
61      * Reads from <code>input</code> and initalizes the value in the Holder
62      * with the unmarshalled data.
63      *
64      * @param input the InputStream containing CDR formatted data from the wire
65      */

66     public void _read(InputStream JavaDoc input) {
67     value = ((org.omg.CORBA_2_3.portable.InputStream JavaDoc)input).read_value();
68     }
69
70     /**
71      * Marshals to <code>output</code> the value in the Holder.
72      *
73      * @param output the OutputStream which will contain the CDR formatted data
74      */

75     public void _write(OutputStream JavaDoc output) {
76     ((org.omg.CORBA_2_3.portable.OutputStream JavaDoc)output).write_value(value);
77     }
78
79     /**
80      * Returns the <code>TypeCode</code> object
81      * corresponding to the value held in the Holder.
82      *
83      * @return the TypeCode of the value held in the holder
84      */

85     public org.omg.CORBA.TypeCode JavaDoc _type() {
86     return ORB.init().get_primitive_tc(TCKind.tk_value);
87     }
88
89 }
90
Popular Tags