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