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