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