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