- java.lang.Object
-
- org.omg.CORBA.NVList
-
public abstract class NVList extends Object
A modifiable list containingNamedValueobjects.The class
NVListis used as follows:- to describe arguments for a
Requestobject in the Dynamic Invocation Interface and the Dynamic Skeleton Interface - to describe context values in a
Contextobject
Each
NamedValueobject consists of the following:- a name, which is a
Stringobject - a value, as an
Anyobject - an argument mode flag
An
NVListobject may be created using one of the followingORBmethods:org.omg.CORBA.ORB.create_listorg.omg.CORBA.NVList nv = orb.create_list(3);The variablenvrepresents a newly-createdNVListobject. 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 anNVListobject in a request, and the method being invoked takes three parameters, you might optimize by supplying 3 to the methodcreate_list. Note that the newNVListwill 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 ofNamedValueobjects to this list regardless of its original length.org.omg.CORBA.ORB.create_operation_listorg.omg.CORBA.NVList nv = orb.create_operation_list(myOperationDef);The variablenvrepresents a newly-createdNVListobject that contains descriptions of the arguments to the method described in the givenOperationDefobject.
The methods in the class
NVListall deal with theNamedValueobjects in the list. There are three methods for adding aNamedValueobject, a method for getting the count ofNamedValueobjects in the list, a method for retrieving aNamedValueobject at a given index, and a method for removing aNamedValueobject at a given index.- Since:
- JDK1.2
- See Also:
Request,ServerRequest,NamedValue,Context
- to describe arguments for a
-
-
Constructor Summary
Constructors Constructor Description NVList()
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description abstract NamedValueadd(int flags)Creates a newNamedValueobject initialized with the given flag and adds it to the end of thisNVListobject.abstract NamedValueadd_item(String item_name, int flags)Creates a newNamedValueobject initialized with the given name and flag, and adds it to the end of thisNVListobject.abstract NamedValueadd_value(String item_name, Any val, int flags)Creates a newNamedValueobject initialized with the given name, value, and flag, and adds it to the end of thisNVListobject.abstract intcount()Returns the number ofNamedValueobjects that have been added to thisNVListobject.abstract NamedValueitem(int index)Retrieves theNamedValueobject at the given index.abstract voidremove(int index)Removes theNamedValueobject at the given index.
-
-
-
Method Detail
-
count
public abstract int count()
Returns the number ofNamedValueobjects that have been added to thisNVListobject.- Returns:
- an
intindicating the number ofNamedValueobjects in thisNVList.
-
add
public abstract NamedValue add(int flags)
Creates a newNamedValueobject initialized with the given flag and adds it to the end of thisNVListobject. The flag can be any one of the argument passing modes:ARG_IN.value,ARG_OUT.value, orARG_INOUT.value.- Parameters:
flags- one of the argument mode flags- Returns:
- the newly-created
NamedValueobject
-
add_item
public abstract NamedValue add_item(String item_name, int flags)
Creates a newNamedValueobject initialized with the given name and flag, and adds it to the end of thisNVListobject. The flag can be any one of the argument passing modes:ARG_IN.value,ARG_OUT.value, orARG_INOUT.value.- Parameters:
item_name- the name for the newNamedValueobjectflags- one of the argument mode flags- Returns:
- the newly-created
NamedValueobject
-
add_value
public abstract NamedValue add_value(String item_name, Any val, int flags)
Creates a newNamedValueobject initialized with the given name, value, and flag, and adds it to the end of thisNVListobject.- Parameters:
item_name- the name for the newNamedValueobjectval- anAnyobject containing the value for the newNamedValueobjectflags- one of the following argument passing modes:ARG_IN.value,ARG_OUT.value, orARG_INOUT.value- Returns:
- the newly created
NamedValueobject
-
item
public abstract NamedValue item(int index) throws Bounds
Retrieves theNamedValueobject at the given index.- Parameters:
index- the index of the desiredNamedValueobject, which must be between zero and the length of the list minus one, inclusive. The first item is at index zero.- Returns:
- the
NamedValueobject at the given index - Throws:
Bounds- if the index is greater than or equal to number ofNamedValueobjects
-
remove
public abstract void remove(int index) throws BoundsRemoves theNamedValueobject at the given index. Note that the indices of allNamedValueobjects following the one removed are shifted down by one.- Parameters:
index- the index of theNamedValueobject to be removed, which must be between zero and the length of the list minus one, inclusive. The first item is at index zero.- Throws:
Bounds- if the index is greater than or equal to number ofNamedValueobjects in the list
-
-