- java.lang.Object
-
- org.omg.CORBA.NamedValue
-
public abstract class NamedValue extends Object
An object used in the DII and DSI to describe arguments and return values.NamedValueobjects are also used in theContextobject routines to pass lists of property names and values.A
NamedValueobject contains:- a name -- If the
NamedValueobject is used to describe arguments to a request, the name will be an argument identifier specified in the OMG IDL interface definition for the operation being described. - a value -- an
Anyobject - an argument mode flag -- one of the following:
ARG_IN.valueARG_OUT.valueARG_INOUT.value- zero -- if this
NamedValueobject represents a property in aContextobject rather than a parameter or return value
The class
NamedValuehas three methods, which access its fields. The following code fragment demonstrates creating aNamedValueobject and then accessing its fields:ORB orb = ORB.init(args, null); String s = "argument_1"; org.omg.CORBA.Any myAny = orb.create_any(); myAny.insert_long(12345); int in = org.omg.CORBA.ARG_IN.value; org.omg.CORBA.NamedValue nv = orb.create_named_value( s, myAny, in); System.out.println("This nv name is " + nv.name()); try { System.out.println("This nv value is " + nv.value().extract_long()); System.out.println("This nv flag is " + nv.flags()); } catch (org.omg.CORBA.BAD_OPERATION b) { System.out.println("extract failed"); }If this code fragment were put into a
mainmethod, the output would be something like the following:This nv name is argument_1 This nv value is 12345 This nv flag is 1Note that the method
valuereturns anAnyobject. In order to access thelongcontained in theAnyobject, we used the methodextract_long. - a name -- If the
-
-
Constructor Summary
Constructors Constructor Description NamedValue()
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description abstract intflags()Retrieves the argument mode flag for thisNamedValueobject.abstract Stringname()Retrieves the name for thisNamedValueobject.abstract Anyvalue()Retrieves the value for thisNamedValueobject.
-
-
-
Method Detail
-
name
public abstract String name()
Retrieves the name for thisNamedValueobject.- Returns:
- a
Stringobject representing the name of thisNamedValueobject
-
value
public abstract Any value()
Retrieves the value for thisNamedValueobject.- Returns:
- an
Anyobject containing the value of thisNamedValueobject
-
flags
public abstract int flags()
Retrieves the argument mode flag for thisNamedValueobject.- Returns:
- an
intrepresenting the argument mode for thisNamedValueobject
-
-