1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161
/* * @(#)NVList.java 1.28 05/11/17 * * Copyright 2006 Sun Microsystems, Inc. All rights reserved. * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms. */ package org.omg.CORBA; /** * A modifiable list containing <code>NamedValue</code> objects. * <P> * The class <code>NVList</code> is used as follows: * <UL> * <LI>to describe arguments for a <code>Request</code> object * in the Dynamic Invocation Interface and * the Dynamic Skeleton Interface * <LI>to describe context values in a <code>Context</code> object * </UL> * <P> * Each <code>NamedValue</code> object consists of the following: * <UL> * <LI>a name, which is a <code>String</code> object * <LI>a value, as an <code>Any</code> object * <LI>an argument mode flag * </UL> * <P> * An <code>NVList</code> object * may be created using one of the following * <code>ORB</code> methods: * <OL> * <LI><code>org.omg.CORBA.ORB.create_list</code> * <PRE> * org.omg.CORBA.NVList nv = orb.create_list(3); * </PRE> * The variable <code>nv</code> represents a newly-created * <code>NVList</code> object. The argument is a memory-management * hint to the orb and does not imply the actual length of the list. * If, for example, you want to use an <code>NVList</code> object * in a request, and the method being invoked takes three parameters, * you might optimize by supplying 3 to the method * <code>create_list</code>. Note that the new <code>NVList</code> * will not necessarily have a length of 3; it * could have a length of 2 or 4, for instance. * Note also that you can add any number of * <code>NamedValue</code> objects to this list regardless of * its original length. * <P> * <LI><code>org.omg.CORBA.ORB.create_operation_list</code> * <PRE> * org.omg.CORBA.NVList nv = orb.create_operation_list(myOperationDef); * </PRE> * The variable <code>nv</code> represents a newly-created * <code>NVList</code> object that contains descriptions of the * arguments to the method described in the given * <code>OperationDef</code> object. * </OL> * <P> * The methods in the class <code>NVList</code> all deal with * the <code>NamedValue</code> objects in the list. * There are three methods for adding a <code>NamedValue</code> object, * a method for getting the count of <code>NamedValue</code> objects in * the list, a method for retrieving a <code>NamedValue</code> object * at a given index, and a method for removing a <code>NamedValue</code> object * at a given index. * * @see org.omg.CORBA.Request * @see org.omg.CORBA.ServerRequest * @see org.omg.CORBA.NamedValue * @see org.omg.CORBA.Context * * @version 1.14 ,09/09/97 * @since JDK1.2 */ public abstract class NVList { /** * Returns the number of <code>NamedValue</code> objects that have * been added to this <code>NVList</code> object. * * @return an <code>int</code> indicating the number of * <code>NamedValue</code> objects in this <code>NVList</code>. */ public abstract int count(); /** * Creates a new <code>NamedValue</code> object initialized with the given flag * and adds it to the end of this <code>NVList</code> object. * The flag can be any one of the argument passing modes: * <code>ARG_IN.value</code>, <code>ARG_OUT.value</code>, or * <code>ARG_INOUT.value</code>. * * @param flags one of the argument mode flags * @return the newly-created <code>NamedValue</code> object */ public abstract NamedValue add(int flags); /** * Creates a new <code>NamedValue</code> object initialized with the * given name and flag, * and adds it to the end of this <code>NVList</code> object. * The flag can be any one of the argument passing modes: * <code>ARG_IN.value</code>, <code>ARG_OUT.value</code>, or * <code>ARG_INOUT.value</code>. * * @param item_name the name for the new <code>NamedValue</code> object * @param flags one of the argument mode flags * @return the newly-created <code>NamedValue</code> object */ public abstract NamedValue add_item(String item_name, int flags); /** * Creates a new <code>NamedValue</code> object initialized with the * given name, value, and flag, * and adds it to the end of this <code>NVList</code> object. * * @param item_name the name for the new <code>NamedValue</code> object * @param val an <code>Any</code> object containing the value * for the new <code>NamedValue</code> object * @param flags one of the following argument passing modes: * <code>ARG_IN.value</code>, <code>ARG_OUT.value</code>, or * <code>ARG_INOUT.value</code> * @return the newly created <code>NamedValue</code> object */ public abstract NamedValue add_value(String item_name, Any val, int flags); /** * Retrieves the <code>NamedValue</code> object at the given index. * * @param index the index of the desired <code>NamedValue</code> object, * which must be between zero and the length of the list * minus one, inclusive. The first item is at index zero. * @return the <code>NamedValue</code> object at the given index * @exception org.omg.CORBA.Bounds if the index is greater than * or equal to number of <code>NamedValue</code> objects */ public abstract NamedValue item(int index) throws org.omg.CORBA.Bounds; /** * Removes the <code>NamedValue</code> object at the given index. * Note that the indices of all <code>NamedValue</code> objects following * the one removed are shifted down by one. * * @param index the index of the <code>NamedValue</code> object to be * removed, which must be between zero and the length * of the list minus one, inclusive. * The first item is at index zero. * @exception org.omg.CORBA.Bounds if the index is greater than * or equal to number of <code>NamedValue</code> objects in * the list */ public abstract void remove(int index) throws org.omg.CORBA.Bounds; }