public abstract class NamedValue extends Object
NamedValue
objects
are also used in the Context
object routines to pass lists of property names and values.
A NamedValue
object contains:
NamedValue
object 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.
Any
object
ARG_IN.value
ARG_OUT.value
ARG_INOUT.value
NamedValue
object represents a property
in a Context
object rather than a parameter or
return value
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
.
Constructor and Description |
---|
NamedValue() |
Modifier and Type | Method and Description |
---|---|
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. |
public abstract String name()
NamedValue
object.String
object representing
the name of this NamedValue
objectpublic abstract Any value()
NamedValue
object.Any
object containing
the value of this NamedValue
objectpublic abstract int flags()
NamedValue
object.int
representing the argument
mode for this NamedValue
object 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, 2022, Oracle and/or its affiliates. All rights reserved. Use is subject to license terms. Also see the documentation redistribution policy.