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

duke@1 1 /*
ohair@240 2 * Copyright (c) 1998, 2010, 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 * The mapping of a CORBA <code>enum</code> tagging
duke@1 30 * <code>SET_OVERRIDE</code> and <code>ADD_OVERRIDE</code>, which
duke@1 31 * indicate whether policies should replace the
duke@1 32 * existing policies of an <code>Object</code> or be added to them.
duke@1 33 * <P>
andrew@135 34 * The method {@link org.omg.CORBA.Object#_set_policy_override} takes
duke@1 35 * either <code>SetOverrideType.SET_OVERRIDE</code> or
duke@1 36 * <code>SetOverrideType.ADD_OVERRIDE</code> as its second argument.
duke@1 37 * The method <code>_set_policy_override</code>
duke@1 38 * creates a new <code>Object</code> initialized with the
duke@1 39 * <code>Policy</code> objects supplied as the first argument. If the
duke@1 40 * second argument is <code>ADD_OVERRIDE</code>, the new policies
duke@1 41 * are added to those of the <code>Object</code> instance that is
duke@1 42 * calling the <code>_set_policy_override</code> method. If
duke@1 43 * <code>SET_OVERRIDE</code> is given instead, the existing policies
duke@1 44 * are replaced with the given ones.
duke@1 45 *
duke@1 46 * @author OMG
duke@1 47 * @since JDK1.2
duke@1 48 */
duke@1 49
duke@1 50 public class SetOverrideType implements org.omg.CORBA.portable.IDLEntity {
duke@1 51
duke@1 52 /**
duke@1 53 * The <code>int</code> constant for the enum value SET_OVERRIDE.
duke@1 54 */
duke@1 55 public static final int _SET_OVERRIDE = 0;
duke@1 56
duke@1 57 /**
duke@1 58 * The <code>int</code> constant for the enum value ADD_OVERRIDE.
duke@1 59 */
duke@1 60 public static final int _ADD_OVERRIDE = 1;
duke@1 61
duke@1 62 /**
duke@1 63 * The <code>SetOverrideType</code> constant for the enum value SET_OVERRIDE.
duke@1 64 */
duke@1 65 public static final SetOverrideType SET_OVERRIDE = new SetOverrideType(_SET_OVERRIDE);
duke@1 66
duke@1 67 /**
duke@1 68 * The <code>SetOverrideType</code> constant for the enum value ADD_OVERRIDE.
duke@1 69 */
duke@1 70 public static final SetOverrideType ADD_OVERRIDE = new SetOverrideType(_ADD_OVERRIDE);
duke@1 71
duke@1 72 /**
duke@1 73 * Retrieves the value of this <code>SetOverrideType</code> instance.
duke@1 74 *
duke@1 75 * @return the <code>int</code> for this <code>SetOverrideType</code> instance.
duke@1 76 */
duke@1 77 public int value() {
duke@1 78 return _value;
duke@1 79 }
duke@1 80
duke@1 81 /**
duke@1 82 * Converts the given <code>int</code> to the corresponding
duke@1 83 * <code>SetOverrideType</code> instance.
duke@1 84 *
duke@1 85 * @param i the <code>int</code> to convert; must be either
duke@1 86 * <code>SetOverrideType._SET_OVERRIDE</code> or
duke@1 87 * <code>SetOverrideType._ADD_OVERRIDE</code>
duke@1 88 * @return the <code>SetOverrideType</code> instance whose value
duke@1 89 * matches the given <code>int</code>
duke@1 90 * @exception BAD_PARAM if the given <code>int</code> does not
duke@1 91 * match the value of
duke@1 92 * any <code>SetOverrideType</code> instance
duke@1 93 */
duke@1 94 public static SetOverrideType from_int(int i)
duke@1 95 {
duke@1 96 switch (i) {
duke@1 97 case _SET_OVERRIDE:
duke@1 98 return SET_OVERRIDE;
duke@1 99 case _ADD_OVERRIDE:
duke@1 100 return ADD_OVERRIDE;
duke@1 101 default:
duke@1 102 throw new org.omg.CORBA.BAD_PARAM();
duke@1 103 }
duke@1 104 }
duke@1 105
duke@1 106 /**
duke@1 107 * Constructs a <code>SetOverrideType</code> instance from an
duke@1 108 * <code>int</code>.
duke@1 109 * @param _value must be either <code>SET_OVERRIDE</code> or
duke@1 110 * <code>ADD_OVERRIDE</code>
duke@1 111 */
duke@1 112 protected SetOverrideType(int _value){
duke@1 113 this._value = _value;
duke@1 114 }
duke@1 115
duke@1 116 /**
duke@1 117 * The field containing the value for this <code>SetOverrideType</code>
duke@1 118 * object.
duke@1 119 *
duke@1 120 */
duke@1 121 private int _value;
duke@1 122 }

mercurial