public abstract class NamedValue extends Object
NamedValue对象也被用在Context对象例程中传递属性名和值的列表。 
        一个NamedValue对象包含: 
NamedValue对象用于描述请求的参数,则该名称将是OMG IDL接口定义中为要描述的操作指定的参数标识符。 Any对象 ARG_IN.value ARG_OUT.value ARG_INOUT.value NamedValue对象表示一个属性Context对象,而不是参数或返回值  NamedValue类有三种访问其领域的方法。 以下代码片段演示了创建一个NamedValue对象,然后访问其字段: 
  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");
    }  
        如果这个代码片段被放在一个main方法中,输出将如下所示: 
  This nv name is argument_1
    This nv value is 12345
    This nv flag is 1  
        请注意,方法value返回一个Any对象。 为了访问所述long包含在Any对象,我们使用的方法extract_long 。 
 Submit a bug or feature 
For further API reference and developer documentation, see Java SE Documentation. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, workarounds, and working code examples.
 Copyright © 1993, 2014, Oracle and/or its affiliates. All rights reserved.