All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.omg.CORBA.NamedValue Maven / Gradle / Ivy

The newest version!
/*
 * Copyright (c) 1996, 1999, Oracle and/or its affiliates. All rights reserved.
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 *
 * This code is free software; you can redistribute it and/or modify it
 * under the terms of the GNU General Public License version 2 only, as
 * published by the Free Software Foundation.  Oracle designates this
 * particular file as subject to the "Classpath" exception as provided
 * by Oracle in the LICENSE file that accompanied this code.
 *
 * This code is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
 * version 2 for more details (a copy is included in the LICENSE file that
 * accompanied this code).
 *
 * You should have received a copy of the GNU General Public License version
 * 2 along with this work; if not, write to the Free Software Foundation,
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
 *
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
 * or visit www.oracle.com if you need additional information or have any
 * questions.
 */

package org.omg.CORBA;

/**
 * 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: *

    *
  • a name -- If the 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. *
  • a value -- an Any object *
  • an argument mode flag -- one of the following: *
      *
    • ARG_IN.value *
    • ARG_OUT.value *
    • ARG_INOUT.value *
    • zero -- if this 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. * * @see Any * @see ARG_IN * @see ARG_INOUT * @see ARG_OUT * * @since JDK1.2 */ public abstract class NamedValue { /** * Retrieves the name for this NamedValue object. * * @return a String object representing * the name of this NamedValue object */ public abstract String name(); /** * Retrieves the value for this NamedValue object. * * @return an Any object containing * the value of this NamedValue object */ public abstract Any value(); /** * Retrieves the argument mode flag for this NamedValue object. * * @return an int representing the argument * mode for this NamedValue object */ public abstract int flags(); }





© 2015 - 2024 Weber Informatics LLC | Privacy Policy