org.omg.CORBA

Class NamedValue


  • public abstract class NamedValue
    extends Object
    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.

    Since:
    JDK1.2
    See Also:
    Any, ARG_IN, ARG_INOUT, ARG_OUT
    • Constructor Detail

      • NamedValue

        public NamedValue()
    • Method Detail

      • name

        public abstract String name()
        Retrieves the name for this NamedValue object.
        Returns:
        a String object representing the name of this NamedValue object
      • value

        public abstract Any value()
        Retrieves the value for this NamedValue object.
        Returns:
        an Any object containing the value of this NamedValue object
      • flags

        public abstract int flags()
        Retrieves the argument mode flag for this NamedValue object.
        Returns:
        an int representing the argument mode for this NamedValue object

Traduction non disponible

Les API Java ne sont pas encore traduites en français sur l'infobrol. Seule la version anglaise est disponible pour l'instant.

Document créé le 29/08/2006, dernière modification le 04/03/2020
Source du document imprimé : https://www.gaudry.be/java-api-rf-org/omg/CORBA/NamedValue.html

L'infobrol est un site personnel dont le contenu n'engage que moi. Le texte est mis à disposition sous licence CreativeCommons(BY-NC-SA). Plus d'info sur les conditions d'utilisation et sur l'auteur.

Références

  1. Consulter le document html Langue du document :fr Manuel PHP : https://docs.oracle.com, NamedValue

Ces références et liens indiquent des documents consultés lors de la rédaction de cette page, ou qui peuvent apporter un complément d'information, mais les auteurs de ces sources ne peuvent être tenus responsables du contenu de cette page.
L'auteur de ce site est seul responsable de la manière dont sont présentés ici les différents concepts, et des libertés qui sont prises avec les ouvrages de référence. N'oubliez pas que vous devez croiser les informations de sources multiples afin de diminuer les risques d'erreurs.

Table des matières Haut