TypeCodeHolder.java revision 0
4169N/A/*
1178N/A * Copyright 1996-2001 Sun Microsystems, Inc. All Rights Reserved.
1178N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
1178N/A *
1178N/A * This code is free software; you can redistribute it and/or modify it
1178N/A * under the terms of the GNU General Public License version 2 only, as
1178N/A * published by the Free Software Foundation. Sun designates this
1178N/A * particular file as subject to the "Classpath" exception as provided
1178N/A * by Sun in the LICENSE file that accompanied this code.
1178N/A *
1178N/A * This code is distributed in the hope that it will be useful, but WITHOUT
1178N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
1178N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
1178N/A * version 2 for more details (a copy is included in the LICENSE file that
1178N/A * accompanied this code).
1178N/A *
1178N/A * You should have received a copy of the GNU General Public License version
2362N/A * 2 along with this work; if not, write to the Free Software Foundation,
2362N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
2362N/A *
1178N/A * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
5176N/A * CA 95054 USA or visit www.sun.com if you need additional information or
1178N/A * have any questions.
0N/A */
4033N/A
1178N/Apackage org.omg.CORBA;
1178N/A
4033N/Aimport org.omg.CORBA.portable.Streamable;
4935N/Aimport org.omg.CORBA.portable.InputStream;
0N/Aimport org.omg.CORBA.portable.OutputStream;
1178N/A
4935N/A/**
0N/A * The Holder for <tt>TypeCode</tt>. For more information on
4935N/A * Holder files, see <a href="doc-files/generatedfiles.html#holder">
0N/A * "Generated Files: Holder Files"</a>.<P>
5176N/A * A Holder class for a <code>TypeCode</code> object
0N/A * that is used to store "out" and "inout" parameters in IDL operations.
4033N/A * If an IDL operation signature has an IDL <code>TypeCode</code> as an "out"
0N/A * or "inout" parameter, the programmer must pass an instance of
0N/A * <code>TypeCodeHolder</code> as the corresponding
0N/A * parameter in the method invocation; for "inout" parameters, the programmer
0N/A * must also fill the "in" value to be sent to the server.
0N/A * Before the method invocation returns, the ORB will fill in the
0N/A * value corresponding to the "out" value returned from the server.
0N/A * <P>
0N/A * If <code>myTypeCodeHolder</code> is an instance of <code>TypeCodeHolder</code>,
0N/A * the value stored in its <code>value</code> field can be accessed with
0N/A * <code>myTypeCodeHolder.value</code>.
4033N/A *
1178N/A * @since JDK1.2
1178N/A */
4935N/Apublic final class TypeCodeHolder implements Streamable {
0N/A
0N/A /**
0N/A * The <code>TypeCode</code> value held by
1178N/A * this <code>TypeCodeHolder</code> object.
4935N/A */
0N/A public TypeCode value;
1178N/A
4935N/A /**
1178N/A * Constructs a new <code>TypeCodeHolder</code> object with its
1178N/A * <code>value</code> field initialized to <code>null</code>.
1178N/A */
1178N/A public TypeCodeHolder() {
4935N/A }
1178N/A
1178N/A /**
4935N/A * Constructs a new <code>TypeCodeHolder</code> object with its
1178N/A * <code>value</code> field initialized to the given
4935N/A * <code>TypeCode</code> object.
1178N/A * @param initial the <code>TypeCode</code> object with which to initialize
5176N/A * the <code>value</code> field of the newly-created
1178N/A * <code>TypeCodeHolder</code> object
4033N/A */
1178N/A public TypeCodeHolder(TypeCode initial) {
1178N/A value = initial;
4033N/A }
1178N/A
1178N/A /**
1178N/A * Reads from <code>input</code> and initalizes the value in
1178N/A * this <code>TypeCodeHolder</code> object
4935N/A * with the unmarshalled data.
0N/A *
0N/A * @param input the InputStream containing CDR formatted data from the wire
0N/A */
0N/A public void _read(InputStream input) {
0N/A value = input.read_TypeCode();
0N/A }
1178N/A
4033N/A /**
1178N/A * Marshals to <code>output</code> the value in
1178N/A * this <code>TypeCodeHolder</code> object.
0N/A *
1178N/A * @param output the OutputStream which will contain the CDR formatted data
4935N/A */
1178N/A public void _write(OutputStream output) {
0N/A output.write_TypeCode(value);
0N/A }
1178N/A
0N/A /**
1178N/A * Returns the TypeCode corresponding to the value held in
4935N/A * this <code>TypeCodeHolder</code> object.
1178N/A *
1178N/A * @return the TypeCode of the value held in
1178N/A * this <code>TypeCodeHolder</code> object
1178N/A */
0N/A public org.omg.CORBA.TypeCode _type() {
1178N/A return ORB.init().get_primitive_tc(TCKind.tk_TypeCode);
4935N/A }
1178N/A}
1178N/A