org.omg.CORBA
Class NamedValue

java.lang.Object sample code for java.lang.Object definition code for java.lang.Object 
  extended by org.omg.CORBA.NamedValue

public abstract class NamedValue
extends Object sample code for java.lang.Object definition code for java.lang.Object

An object used in the DII and DSI to describe arguments and return values. NamedValue objects are also used in the Context object routines to pass lists of property names and values.

A NamedValue object contains:

The class NamedValue has three methods, which access its fields. The following code fragment demonstrates creating a NamedValue object 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 main method, the output would be something like the following:

    This nv name is argument_1
    This nv value is 12345
    This nv flag is 1
 

Note that the method value returns an Any object. In order to access the long contained in the Any object, we used the method extract_long.

Since:
JDK1.2
See Also:
Any sample code for org.omg.CORBA.Any definition code for org.omg.CORBA.Any , ARG_IN sample code for org.omg.CORBA.ARG_IN definition code for org.omg.CORBA.ARG_IN , ARG_INOUT sample code for org.omg.CORBA.ARG_INOUT definition code for org.omg.CORBA.ARG_INOUT , ARG_OUT sample code for org.omg.CORBA.ARG_OUT definition code for org.omg.CORBA.ARG_OUT

Constructor Summary
NamedValue sample code for org.omg.CORBA.NamedValue.NamedValue() definition code for org.omg.CORBA.NamedValue.NamedValue() ()
           
 
Method Summary
abstract  int flags sample code for org.omg.CORBA.NamedValue.flags() definition code for org.omg.CORBA.NamedValue.flags() ()
          Retrieves the argument mode flag for this NamedValue object.
abstract  String sample code for java.lang.String definition code for java.lang.String name sample code for org.omg.CORBA.NamedValue.name() definition code for org.omg.CORBA.NamedValue.name() ()
          Retrieves the name for this NamedValue object.
abstract  Any sample code for org.omg.CORBA.Any definition code for org.omg.CORBA.Any value sample code for org.omg.CORBA.NamedValue.value() definition code for org.omg.CORBA.NamedValue.value() ()
          Retrieves the value for this NamedValue object.
 
Methods inherited from class java.lang.Object sample code for java.lang.Object definition code for java.lang.Object
clone sample code for java.lang.Object.clone() definition code for java.lang.Object.clone() , equals sample code for java.lang.Object.equals(java.lang.Object) definition code for java.lang.Object.equals(java.lang.Object) , finalize sample code for java.lang.Object.finalize() definition code for java.lang.Object.finalize() , getClass sample code for java.lang.Object.getClass() definition code for java.lang.Object.getClass() , hashCode sample code for java.lang.Object.hashCode() definition code for java.lang.Object.hashCode() , notify sample code for java.lang.Object.notify() definition code for java.lang.Object.notify() , notifyAll sample code for java.lang.Object.notifyAll() definition code for java.lang.Object.notifyAll() , toString sample code for java.lang.Object.toString() definition code for java.lang.Object.toString() , wait sample code for java.lang.Object.wait() definition code for java.lang.Object.wait() , wait sample code for java.lang.Object.wait(long) definition code for java.lang.Object.wait(long) , wait sample code for java.lang.Object.wait(long, int) definition code for java.lang.Object.wait(long, int)
 

Constructor Detail

NamedValue sample code for org.omg.CORBA.NamedValue() definition code for org.omg.CORBA.NamedValue()

public NamedValue()
Method Detail

name sample code for org.omg.CORBA.NamedValue.name() definition code for org.omg.CORBA.NamedValue.name()

public abstract String sample code for java.lang.String definition code for java.lang.String  name()
Retrieves the name for this NamedValue object.

Returns:
a String object representing the name of this NamedValue object

value sample code for org.omg.CORBA.NamedValue.value() definition code for org.omg.CORBA.NamedValue.value()

public abstract Any sample code for org.omg.CORBA.Any definition code for org.omg.CORBA.Any  value()
Retrieves the value for this NamedValue object.

Returns:
an Any object containing the value of this NamedValue object

flags sample code for org.omg.CORBA.NamedValue.flags() definition code for org.omg.CORBA.NamedValue.flags()

public abstract int flags()
Retrieves the argument mode flag for this NamedValue object.

Returns:
an int representing the argument mode for this NamedValue object