28 import org.omg.CORBA.portable.InputStream; |
28 import org.omg.CORBA.portable.InputStream; |
29 import org.omg.CORBA.portable.OutputStream; |
29 import org.omg.CORBA.portable.OutputStream; |
30 |
30 |
31 |
31 |
32 /** |
32 /** |
33 * The Holder for <tt>Boolean</tt>. For more information on |
33 * The Holder for {@code Boolean}. For more information on |
34 * Holder files, see <a href="doc-files/generatedfiles.html#holder"> |
34 * Holder files, see <a href="doc-files/generatedfiles.html#holder"> |
35 * "Generated Files: Holder Files"</a>.<P> |
35 * "Generated Files: Holder Files"</a>.<P> |
36 * A Holder class for a <code>boolean</code> |
36 * A Holder class for a {@code boolean} |
37 * that is used to store "out" and "inout" parameters in IDL methods. |
37 * that is used to store "out" and "inout" parameters in IDL methods. |
38 * If an IDL method signature has an IDL <code>boolean</code> as an "out" |
38 * If an IDL method signature has an IDL {@code boolean} as an "out" |
39 * or "inout" parameter, the programmer must pass an instance of |
39 * or "inout" parameter, the programmer must pass an instance of |
40 * <code>BooleanHolder</code> as the corresponding |
40 * {@code BooleanHolder} as the corresponding |
41 * parameter in the method invocation; for "inout" parameters, the programmer |
41 * parameter in the method invocation; for "inout" parameters, the programmer |
42 * must also fill the "in" value to be sent to the server. |
42 * must also fill the "in" value to be sent to the server. |
43 * Before the method invocation returns, the ORB will fill in the |
43 * Before the method invocation returns, the ORB will fill in the |
44 * value corresponding to the "out" value returned from the server. |
44 * value corresponding to the "out" value returned from the server. |
45 * <P> |
45 * <P> |
46 * If <code>myBooleanHolder</code> is an instance of <code>BooleanHolder</code>, |
46 * If {@code myBooleanHolder} is an instance of {@code BooleanHolder}, |
47 * the value stored in its <code>value</code> field can be accessed with |
47 * the value stored in its {@code value} field can be accessed with |
48 * <code>myBooleanHolder.value</code>. |
48 * {@code myBooleanHolder.value}. |
49 * |
49 * |
50 * @since JDK1.2 |
50 * @since JDK1.2 |
51 */ |
51 */ |
52 public final class BooleanHolder implements Streamable { |
52 public final class BooleanHolder implements Streamable { |
53 |
53 |
54 /** |
54 /** |
55 * The <code>boolean</code> value held by this <code>BooleanHolder</code> |
55 * The {@code boolean} value held by this {@code BooleanHolder} |
56 * object. |
56 * object. |
57 */ |
57 */ |
58 public boolean value; |
58 public boolean value; |
59 |
59 |
60 /** |
60 /** |
61 * Constructs a new <code>BooleanHolder</code> object with its |
61 * Constructs a new {@code BooleanHolder} object with its |
62 * <code>value</code> field initialized to <code>false</code>. |
62 * {@code value} field initialized to {@code false}. |
63 */ |
63 */ |
64 public BooleanHolder() { |
64 public BooleanHolder() { |
65 } |
65 } |
66 |
66 |
67 /** |
67 /** |
68 * Constructs a new <code>BooleanHolder</code> object with its |
68 * Constructs a new {@code BooleanHolder} object with its |
69 * <code>value</code> field initialized with the given <code>boolean</code>. |
69 * {@code value} field initialized with the given {@code boolean}. |
70 * @param initial the <code>boolean</code> with which to initialize |
70 * @param initial the {@code boolean} with which to initialize |
71 * the <code>value</code> field of the newly-created |
71 * the {@code value} field of the newly-created |
72 * <code>BooleanHolder</code> object |
72 * {@code BooleanHolder} object |
73 */ |
73 */ |
74 public BooleanHolder(boolean initial) { |
74 public BooleanHolder(boolean initial) { |
75 value = initial; |
75 value = initial; |
76 } |
76 } |
77 |
77 |
78 /** |
78 /** |
79 * Reads unmarshalled data from <code>input</code> and assigns it to this |
79 * Reads unmarshalled data from {@code input} and assigns it to this |
80 * <code>BooleanHolder</code> object's <code>value</code> field. |
80 * {@code BooleanHolder} object's {@code value} field. |
81 * |
81 * |
82 * @param input the <code>InputStream</code> object containing |
82 * @param input the {@code InputStream} object containing |
83 * CDR formatted data from the wire |
83 * CDR formatted data from the wire |
84 */ |
84 */ |
85 public void _read(InputStream input) { |
85 public void _read(InputStream input) { |
86 value = input.read_boolean(); |
86 value = input.read_boolean(); |
87 } |
87 } |
88 |
88 |
89 /** |
89 /** |
90 * Marshals the value in this <code>BooleanHolder</code> object's |
90 * Marshals the value in this {@code BooleanHolder} object's |
91 * <code>value</code> field to the output stream <code>output</code>. |
91 * {@code value} field to the output stream {@code output}. |
92 * |
92 * |
93 * @param output the OutputStream which will contain the CDR formatted data |
93 * @param output the OutputStream which will contain the CDR formatted data |
94 */ |
94 */ |
95 public void _write(OutputStream output) { |
95 public void _write(OutputStream output) { |
96 output.write_boolean(value); |
96 output.write_boolean(value); |
97 } |
97 } |
98 |
98 |
99 /** |
99 /** |
100 * Retrieves the <code>TypeCode</code> object that corresponds to the |
100 * Retrieves the {@code TypeCode} object that corresponds to the |
101 * value held in this <code>BooleanHolder</code> object. |
101 * value held in this {@code BooleanHolder} object. |
102 * |
102 * |
103 * @return the <code>TypeCode</code> for the value held |
103 * @return the {@code TypeCode} for the value held |
104 * in this <code>BooleanHolder</code> object |
104 * in this {@code BooleanHolder} object |
105 */ |
105 */ |
106 public TypeCode _type() { |
106 public TypeCode _type() { |
107 return ORB.init().get_primitive_tc(TCKind.tk_boolean); |
107 return ORB.init().get_primitive_tc(TCKind.tk_boolean); |
108 } |
108 } |
109 } |
109 } |