src/share/classes/org/omg/CORBA/NamedValue.java

Tue, 21 Jan 2014 16:26:59 +0000

author
msheppar
date
Tue, 21 Jan 2014 16:26:59 +0000
changeset 615
8b0b643ffd42
parent 158
91006f157c46
child 748
6845b95cba6b
permissions
-rw-r--r--

8025005: Enhance CORBA initializations
Summary: restructure ORB.init() processing flow.
Reviewed-by: alanb, coffeys, skoivu

duke@1 1 /*
ohair@158 2 * Copyright (c) 1996, 1999, Oracle and/or its affiliates. All rights reserved.
duke@1 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
duke@1 4 *
duke@1 5 * This code is free software; you can redistribute it and/or modify it
duke@1 6 * under the terms of the GNU General Public License version 2 only, as
ohair@158 7 * published by the Free Software Foundation. Oracle designates this
duke@1 8 * particular file as subject to the "Classpath" exception as provided
ohair@158 9 * by Oracle in the LICENSE file that accompanied this code.
duke@1 10 *
duke@1 11 * This code is distributed in the hope that it will be useful, but WITHOUT
duke@1 12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
duke@1 13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
duke@1 14 * version 2 for more details (a copy is included in the LICENSE file that
duke@1 15 * accompanied this code).
duke@1 16 *
duke@1 17 * You should have received a copy of the GNU General Public License version
duke@1 18 * 2 along with this work; if not, write to the Free Software Foundation,
duke@1 19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
duke@1 20 *
ohair@158 21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
ohair@158 22 * or visit www.oracle.com if you need additional information or have any
ohair@158 23 * questions.
duke@1 24 */
duke@1 25
duke@1 26 package org.omg.CORBA;
duke@1 27
duke@1 28 /**
duke@1 29 * An object used in the DII and DSI to describe
duke@1 30 * arguments and return values. <code>NamedValue</code> objects
duke@1 31 * are also used in the <code>Context</code>
duke@1 32 * object routines to pass lists of property names and values.
duke@1 33 * <P>
duke@1 34 * A <code>NamedValue</code> object contains:
duke@1 35 * <UL>
duke@1 36 * <LI>a name -- If the <code>NamedValue</code> object is used to
duke@1 37 * describe arguments to a request, the name will be an argument
duke@1 38 * identifier specified in the OMG IDL interface definition
duke@1 39 * for the operation being described.
duke@1 40 * <LI>a value -- an <code>Any</code> object
duke@1 41 * <LI>an argument mode flag -- one of the following:
duke@1 42 * <UL>
duke@1 43 * <LI><code>ARG_IN.value</code>
duke@1 44 * <LI><code>ARG_OUT.value</code>
duke@1 45 * <LI><code>ARG_INOUT.value</code>
duke@1 46 * <LI>zero -- if this <code>NamedValue</code> object represents a property
duke@1 47 * in a <code>Context</code> object rather than a parameter or
duke@1 48 * return value
duke@1 49 * </UL>
duke@1 50 * </UL>
duke@1 51 * <P>
duke@1 52 * The class <code>NamedValue</code> has three methods, which
duke@1 53 * access its fields. The following code fragment demonstrates
duke@1 54 * creating a <code>NamedValue</code> object and then accessing
duke@1 55 * its fields:
duke@1 56 * <PRE>
duke@1 57 * ORB orb = ORB.init(args, null);
duke@1 58 * String s = "argument_1";
duke@1 59 * org.omg.CORBA.Any myAny = orb.create_any();
duke@1 60 * myAny.insert_long(12345);
duke@1 61 * int in = org.omg.CORBA.ARG_IN.value;
duke@1 62
duke@1 63 * org.omg.CORBA.NamedValue nv = orb.create_named_value(
duke@1 64 * s, myAny, in);
duke@1 65 * System.out.println("This nv name is " + nv.name());
duke@1 66 * try {
duke@1 67 * System.out.println("This nv value is " + nv.value().extract_long());
duke@1 68 * System.out.println("This nv flag is " + nv.flags());
duke@1 69 * } catch (org.omg.CORBA.BAD_OPERATION b) {
duke@1 70 * System.out.println("extract failed");
duke@1 71 * }
duke@1 72 * </PRE>
duke@1 73 *
duke@1 74 * <P>
duke@1 75 * If this code fragment were put into a <code>main</code> method,
duke@1 76 * the output would be something like the following:
duke@1 77 * <PRE>
duke@1 78 * This nv name is argument_1
duke@1 79 * This nv value is 12345
duke@1 80 * This nv flag is 1
duke@1 81 * </PRE>
duke@1 82 * <P>
duke@1 83 * Note that the method <code>value</code> returns an <code>Any</code>
duke@1 84 * object. In order to access the <code>long</code> contained in the
duke@1 85 * <code>Any</code> object,
duke@1 86 * we used the method <code>extract_long</code>.
duke@1 87 *
duke@1 88 * @see Any
duke@1 89 * @see ARG_IN
duke@1 90 * @see ARG_INOUT
duke@1 91 * @see ARG_OUT
duke@1 92 *
duke@1 93 * @since JDK1.2
duke@1 94 */
duke@1 95
duke@1 96 public abstract class NamedValue {
duke@1 97
duke@1 98 /**
duke@1 99 * Retrieves the name for this <code>NamedValue</code> object.
duke@1 100 *
duke@1 101 * @return a <code>String</code> object representing
duke@1 102 * the name of this <code>NamedValue</code> object
duke@1 103 */
duke@1 104
duke@1 105 public abstract String name();
duke@1 106
duke@1 107 /**
duke@1 108 * Retrieves the value for this <code>NamedValue</code> object.
duke@1 109 *
duke@1 110 * @return an <code>Any</code> object containing
duke@1 111 * the value of this <code>NamedValue</code> object
duke@1 112 */
duke@1 113
duke@1 114 public abstract Any value();
duke@1 115
duke@1 116 /**
duke@1 117 * Retrieves the argument mode flag for this <code>NamedValue</code> object.
duke@1 118 *
duke@1 119 * @return an <code>int</code> representing the argument
duke@1 120 * mode for this <code>NamedValue</code> object
duke@1 121 */
duke@1 122
duke@1 123 public abstract int flags();
duke@1 124
duke@1 125 }

mercurial