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