src/share/classes/org/omg/CORBA/NVList.java

Thu, 31 Aug 2017 18:10:36 +0800

author
aoqi
date
Thu, 31 Aug 2017 18:10:36 +0800
changeset 748
6845b95cba6b
parent 158
91006f157c46
parent 0
7ef37b2cdcad
permissions
-rw-r--r--

merge

aoqi@0 1 /*
aoqi@0 2 * Copyright (c) 1996, 2000, Oracle and/or its affiliates. All rights reserved.
aoqi@0 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
aoqi@0 4 *
aoqi@0 5 * This code is free software; you can redistribute it and/or modify it
aoqi@0 6 * under the terms of the GNU General Public License version 2 only, as
aoqi@0 7 * published by the Free Software Foundation. Oracle designates this
aoqi@0 8 * particular file as subject to the "Classpath" exception as provided
aoqi@0 9 * by Oracle in the LICENSE file that accompanied this code.
aoqi@0 10 *
aoqi@0 11 * This code is distributed in the hope that it will be useful, but WITHOUT
aoqi@0 12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
aoqi@0 13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
aoqi@0 14 * version 2 for more details (a copy is included in the LICENSE file that
aoqi@0 15 * accompanied this code).
aoqi@0 16 *
aoqi@0 17 * You should have received a copy of the GNU General Public License version
aoqi@0 18 * 2 along with this work; if not, write to the Free Software Foundation,
aoqi@0 19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
aoqi@0 20 *
aoqi@0 21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
aoqi@0 22 * or visit www.oracle.com if you need additional information or have any
aoqi@0 23 * questions.
aoqi@0 24 */
aoqi@0 25
aoqi@0 26 package org.omg.CORBA;
aoqi@0 27
aoqi@0 28 /**
aoqi@0 29 * A modifiable list containing <code>NamedValue</code> objects.
aoqi@0 30 * <P>
aoqi@0 31 * The class <code>NVList</code> is used as follows:
aoqi@0 32 * <UL>
aoqi@0 33 * <LI>to describe arguments for a <code>Request</code> object
aoqi@0 34 * in the Dynamic Invocation Interface and
aoqi@0 35 * the Dynamic Skeleton Interface
aoqi@0 36 * <LI>to describe context values in a <code>Context</code> object
aoqi@0 37 * </UL>
aoqi@0 38 * <P>
aoqi@0 39 * Each <code>NamedValue</code> object consists of the following:
aoqi@0 40 * <UL>
aoqi@0 41 * <LI>a name, which is a <code>String</code> object
aoqi@0 42 * <LI>a value, as an <code>Any</code> object
aoqi@0 43 * <LI>an argument mode flag
aoqi@0 44 * </UL>
aoqi@0 45 * <P>
aoqi@0 46 * An <code>NVList</code> object
aoqi@0 47 * may be created using one of the following
aoqi@0 48 * <code>ORB</code> methods:
aoqi@0 49 * <OL>
aoqi@0 50 * <LI><code>org.omg.CORBA.ORB.create_list</code>
aoqi@0 51 * <PRE>
aoqi@0 52 * org.omg.CORBA.NVList nv = orb.create_list(3);
aoqi@0 53 * </PRE>
aoqi@0 54 * The variable <code>nv</code> represents a newly-created
aoqi@0 55 * <code>NVList</code> object. The argument is a memory-management
aoqi@0 56 * hint to the orb and does not imply the actual length of the list.
aoqi@0 57 * If, for example, you want to use an <code>NVList</code> object
aoqi@0 58 * in a request, and the method being invoked takes three parameters,
aoqi@0 59 * you might optimize by supplying 3 to the method
aoqi@0 60 * <code>create_list</code>. Note that the new <code>NVList</code>
aoqi@0 61 * will not necessarily have a length of 3; it
aoqi@0 62 * could have a length of 2 or 4, for instance.
aoqi@0 63 * Note also that you can add any number of
aoqi@0 64 * <code>NamedValue</code> objects to this list regardless of
aoqi@0 65 * its original length.
aoqi@0 66 * <P>
aoqi@0 67 * <LI><code>org.omg.CORBA.ORB.create_operation_list</code>
aoqi@0 68 * <PRE>
aoqi@0 69 * org.omg.CORBA.NVList nv = orb.create_operation_list(myOperationDef);
aoqi@0 70 * </PRE>
aoqi@0 71 * The variable <code>nv</code> represents a newly-created
aoqi@0 72 * <code>NVList</code> object that contains descriptions of the
aoqi@0 73 * arguments to the method described in the given
aoqi@0 74 * <code>OperationDef</code> object.
aoqi@0 75 * </OL>
aoqi@0 76 * <P>
aoqi@0 77 * The methods in the class <code>NVList</code> all deal with
aoqi@0 78 * the <code>NamedValue</code> objects in the list.
aoqi@0 79 * There are three methods for adding a <code>NamedValue</code> object,
aoqi@0 80 * a method for getting the count of <code>NamedValue</code> objects in
aoqi@0 81 * the list, a method for retrieving a <code>NamedValue</code> object
aoqi@0 82 * at a given index, and a method for removing a <code>NamedValue</code> object
aoqi@0 83 * at a given index.
aoqi@0 84 *
aoqi@0 85 * @see org.omg.CORBA.Request
aoqi@0 86 * @see org.omg.CORBA.ServerRequest
aoqi@0 87 * @see org.omg.CORBA.NamedValue
aoqi@0 88 * @see org.omg.CORBA.Context
aoqi@0 89 *
aoqi@0 90 * @since JDK1.2
aoqi@0 91 */
aoqi@0 92
aoqi@0 93 public abstract class NVList {
aoqi@0 94
aoqi@0 95 /**
aoqi@0 96 * Returns the number of <code>NamedValue</code> objects that have
aoqi@0 97 * been added to this <code>NVList</code> object.
aoqi@0 98 *
aoqi@0 99 * @return an <code>int</code> indicating the number of
aoqi@0 100 * <code>NamedValue</code> objects in this <code>NVList</code>.
aoqi@0 101 */
aoqi@0 102
aoqi@0 103 public abstract int count();
aoqi@0 104
aoqi@0 105 /**
aoqi@0 106 * Creates a new <code>NamedValue</code> object initialized with the given flag
aoqi@0 107 * and adds it to the end of this <code>NVList</code> object.
aoqi@0 108 * The flag can be any one of the argument passing modes:
aoqi@0 109 * <code>ARG_IN.value</code>, <code>ARG_OUT.value</code>, or
aoqi@0 110 * <code>ARG_INOUT.value</code>.
aoqi@0 111 *
aoqi@0 112 * @param flags one of the argument mode flags
aoqi@0 113 * @return the newly-created <code>NamedValue</code> object
aoqi@0 114 */
aoqi@0 115
aoqi@0 116 public abstract NamedValue add(int flags);
aoqi@0 117
aoqi@0 118 /**
aoqi@0 119 * Creates a new <code>NamedValue</code> object initialized with the
aoqi@0 120 * given name and flag,
aoqi@0 121 * and adds it to the end of this <code>NVList</code> object.
aoqi@0 122 * The flag can be any one of the argument passing modes:
aoqi@0 123 * <code>ARG_IN.value</code>, <code>ARG_OUT.value</code>, or
aoqi@0 124 * <code>ARG_INOUT.value</code>.
aoqi@0 125 *
aoqi@0 126 * @param item_name the name for the new <code>NamedValue</code> object
aoqi@0 127 * @param flags one of the argument mode flags
aoqi@0 128 * @return the newly-created <code>NamedValue</code> object
aoqi@0 129 */
aoqi@0 130
aoqi@0 131 public abstract NamedValue add_item(String item_name, int flags);
aoqi@0 132
aoqi@0 133 /**
aoqi@0 134 * Creates a new <code>NamedValue</code> object initialized with the
aoqi@0 135 * given name, value, and flag,
aoqi@0 136 * and adds it to the end of this <code>NVList</code> object.
aoqi@0 137 *
aoqi@0 138 * @param item_name the name for the new <code>NamedValue</code> object
aoqi@0 139 * @param val an <code>Any</code> object containing the value
aoqi@0 140 * for the new <code>NamedValue</code> object
aoqi@0 141 * @param flags one of the following argument passing modes:
aoqi@0 142 * <code>ARG_IN.value</code>, <code>ARG_OUT.value</code>, or
aoqi@0 143 * <code>ARG_INOUT.value</code>
aoqi@0 144 * @return the newly created <code>NamedValue</code> object
aoqi@0 145 */
aoqi@0 146
aoqi@0 147 public abstract NamedValue add_value(String item_name, Any val, int flags);
aoqi@0 148
aoqi@0 149 /**
aoqi@0 150 * Retrieves the <code>NamedValue</code> object at the given index.
aoqi@0 151 *
aoqi@0 152 * @param index the index of the desired <code>NamedValue</code> object,
aoqi@0 153 * which must be between zero and the length of the list
aoqi@0 154 * minus one, inclusive. The first item is at index zero.
aoqi@0 155 * @return the <code>NamedValue</code> object at the given index
aoqi@0 156 * @exception org.omg.CORBA.Bounds if the index is greater than
aoqi@0 157 * or equal to number of <code>NamedValue</code> objects
aoqi@0 158 */
aoqi@0 159
aoqi@0 160 public abstract NamedValue item(int index) throws org.omg.CORBA.Bounds;
aoqi@0 161
aoqi@0 162 /**
aoqi@0 163 * Removes the <code>NamedValue</code> object at the given index.
aoqi@0 164 * Note that the indices of all <code>NamedValue</code> objects following
aoqi@0 165 * the one removed are shifted down by one.
aoqi@0 166 *
aoqi@0 167 * @param index the index of the <code>NamedValue</code> object to be
aoqi@0 168 * removed, which must be between zero and the length
aoqi@0 169 * of the list minus one, inclusive.
aoqi@0 170 * The first item is at index zero.
aoqi@0 171 * @exception org.omg.CORBA.Bounds if the index is greater than
aoqi@0 172 * or equal to number of <code>NamedValue</code> objects in
aoqi@0 173 * the list
aoqi@0 174 */
aoqi@0 175
aoqi@0 176 public abstract void remove(int index) throws org.omg.CORBA.Bounds;
aoqi@0 177
aoqi@0 178 }

mercurial