JavaTM 2 Platform
Standard Edition

Class NamedValue


public abstract class NamedValue
extends 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();
    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 " +;
    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.

See Also:

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

Constructor Detail


public NamedValue()
Method Detail


public abstract String name()
Retrieves the name for this NamedValue object.
a String object representing the name of this NamedValue object


public abstract Any value()
Retrieves the value for this NamedValue object.
an Any object containing the value of this NamedValue object


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

JavaTM 2 Platform
Standard Edition

Submit a bug or feature
Java, Java 2D, and JDBC are a trademarks or registered trademarks of Sun Microsystems, Inc. in the US and other countries.
Copyright 1993-1999 Sun Microsystems, Inc. 901 San Antonio Road,
Palo Alto, California, 94303, U.S.A. All Rights Reserved.