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

Tue, 28 Dec 2010 15:52:36 -0800

author
ohair
date
Tue, 28 Dec 2010 15:52:36 -0800
changeset 240
f90b3e014e83
parent 158
91006f157c46
child 748
6845b95cba6b
permissions
-rw-r--r--

6962318: Update copyright year
Reviewed-by: xdono

     1 /*
     2  * Copyright (c) 1998, 2010, Oracle and/or its affiliates. All rights reserved.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4  *
     5  * This code is free software; you can redistribute it and/or modify it
     6  * under the terms of the GNU General Public License version 2 only, as
     7  * published by the Free Software Foundation.  Oracle designates this
     8  * particular file as subject to the "Classpath" exception as provided
     9  * by Oracle in the LICENSE file that accompanied this code.
    10  *
    11  * This code is distributed in the hope that it will be useful, but WITHOUT
    12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
    13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
    14  * version 2 for more details (a copy is included in the LICENSE file that
    15  * accompanied this code).
    16  *
    17  * You should have received a copy of the GNU General Public License version
    18  * 2 along with this work; if not, write to the Free Software Foundation,
    19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
    20  *
    21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
    22  * or visit www.oracle.com if you need additional information or have any
    23  * questions.
    24  */
    26 package org.omg.CORBA;
    28 /**
    29  * The mapping of a CORBA <code>enum</code> tagging
    30  * <code>SET_OVERRIDE</code> and <code>ADD_OVERRIDE</code>, which
    31  * indicate whether policies should replace the
    32  * existing policies of an <code>Object</code> or be added to them.
    33  * <P>
    34  * The method {@link org.omg.CORBA.Object#_set_policy_override} takes
    35  * either <code>SetOverrideType.SET_OVERRIDE</code> or
    36  * <code>SetOverrideType.ADD_OVERRIDE</code> as its second argument.
    37  * The method <code>_set_policy_override</code>
    38  * creates a new <code>Object</code> initialized with the
    39  * <code>Policy</code> objects supplied as the first argument.  If the
    40  * second argument is <code>ADD_OVERRIDE</code>, the new policies
    41  * are added to those of the <code>Object</code> instance that is
    42  * calling the <code>_set_policy_override</code> method.  If
    43  * <code>SET_OVERRIDE</code> is given instead, the existing policies
    44  * are replaced with the given ones.
    45  *
    46  * @author OMG
    47  * @since   JDK1.2
    48  */
    50 public class SetOverrideType implements org.omg.CORBA.portable.IDLEntity {
    52     /**
    53      * The <code>int</code> constant for the enum value SET_OVERRIDE.
    54      */
    55     public static final int _SET_OVERRIDE = 0;
    57     /**
    58      * The <code>int</code> constant for the enum value ADD_OVERRIDE.
    59      */
    60     public static final int _ADD_OVERRIDE = 1;
    62     /**
    63      * The <code>SetOverrideType</code> constant for the enum value SET_OVERRIDE.
    64      */
    65     public static final SetOverrideType SET_OVERRIDE = new SetOverrideType(_SET_OVERRIDE);
    67     /**
    68      * The <code>SetOverrideType</code> constant for the enum value ADD_OVERRIDE.
    69      */
    70     public static final SetOverrideType ADD_OVERRIDE = new SetOverrideType(_ADD_OVERRIDE);
    72     /**
    73      * Retrieves the value of this <code>SetOverrideType</code> instance.
    74      *
    75      * @return  the <code>int</code> for this <code>SetOverrideType</code> instance.
    76      */
    77     public int value() {
    78         return _value;
    79     }
    81     /**
    82      * Converts the given <code>int</code> to the corresponding
    83      * <code>SetOverrideType</code> instance.
    84      *
    85      * @param  i the <code>int</code> to convert; must be either
    86      *         <code>SetOverrideType._SET_OVERRIDE</code> or
    87      *         <code>SetOverrideType._ADD_OVERRIDE</code>
    88      * @return  the <code>SetOverrideType</code> instance whose value
    89      *       matches the given <code>int</code>
    90      * @exception  BAD_PARAM  if the given <code>int</code> does not
    91      *       match the value of
    92      *       any <code>SetOverrideType</code> instance
    93      */
    94     public static SetOverrideType from_int(int i)
    95     {
    96         switch (i) {
    97         case _SET_OVERRIDE:
    98             return SET_OVERRIDE;
    99         case _ADD_OVERRIDE:
   100             return ADD_OVERRIDE;
   101         default:
   102             throw new org.omg.CORBA.BAD_PARAM();
   103         }
   104     }
   106     /**
   107      * Constructs a <code>SetOverrideType</code> instance from an
   108      * <code>int</code>.
   109      * @param _value must be either <code>SET_OVERRIDE</code> or
   110      *        <code>ADD_OVERRIDE</code>
   111      */
   112     protected SetOverrideType(int _value){
   113         this._value = _value;
   114     }
   116     /**
   117      * The field containing the value for this <code>SetOverrideType</code>
   118      * object.
   119      *
   120      */
   121     private int _value;
   122 }

mercurial