duke@1: /*
duke@1: * Copyright 1998-2000 Sun Microsystems, Inc. All Rights Reserved.
duke@1: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
duke@1: *
duke@1: * This code is free software; you can redistribute it and/or modify it
duke@1: * under the terms of the GNU General Public License version 2 only, as
duke@1: * published by the Free Software Foundation. Sun designates this
duke@1: * particular file as subject to the "Classpath" exception as provided
duke@1: * by Sun in the LICENSE file that accompanied this code.
duke@1: *
duke@1: * This code is distributed in the hope that it will be useful, but WITHOUT
duke@1: * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
duke@1: * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
duke@1: * version 2 for more details (a copy is included in the LICENSE file that
duke@1: * accompanied this code).
duke@1: *
duke@1: * You should have received a copy of the GNU General Public License version
duke@1: * 2 along with this work; if not, write to the Free Software Foundation,
duke@1: * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
duke@1: *
duke@1: * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
duke@1: * CA 95054 USA or visit www.sun.com if you need additional information or
duke@1: * have any questions.
duke@1: */
duke@1:
duke@1: package org.omg.CORBA;
duke@1:
duke@1: /**
duke@1: * The mapping of a CORBA enum
tagging
duke@1: * SET_OVERRIDE
and ADD_OVERRIDE
, which
duke@1: * indicate whether policies should replace the
duke@1: * existing policies of an Object
or be added to them.
duke@1: *
duke@1: * The method {@link omg.org.CORBA.Object._set_policy_override} takes
duke@1: * either SetOverrideType.SET_OVERRIDE
or
duke@1: * SetOverrideType.ADD_OVERRIDE
as its second argument.
duke@1: * The method _set_policy_override
duke@1: * creates a new Object
initialized with the
duke@1: * Policy
objects supplied as the first argument. If the
duke@1: * second argument is ADD_OVERRIDE
, the new policies
duke@1: * are added to those of the Object
instance that is
duke@1: * calling the _set_policy_override
method. If
duke@1: * SET_OVERRIDE
is given instead, the existing policies
duke@1: * are replaced with the given ones.
duke@1: *
duke@1: * @author OMG
duke@1: * @since JDK1.2
duke@1: */
duke@1:
duke@1: public class SetOverrideType implements org.omg.CORBA.portable.IDLEntity {
duke@1:
duke@1: /**
duke@1: * The int
constant for the enum value SET_OVERRIDE.
duke@1: */
duke@1: public static final int _SET_OVERRIDE = 0;
duke@1:
duke@1: /**
duke@1: * The int
constant for the enum value ADD_OVERRIDE.
duke@1: */
duke@1: public static final int _ADD_OVERRIDE = 1;
duke@1:
duke@1: /**
duke@1: * The SetOverrideType
constant for the enum value SET_OVERRIDE.
duke@1: */
duke@1: public static final SetOverrideType SET_OVERRIDE = new SetOverrideType(_SET_OVERRIDE);
duke@1:
duke@1: /**
duke@1: * The SetOverrideType
constant for the enum value ADD_OVERRIDE.
duke@1: */
duke@1: public static final SetOverrideType ADD_OVERRIDE = new SetOverrideType(_ADD_OVERRIDE);
duke@1:
duke@1: /**
duke@1: * Retrieves the value of this SetOverrideType
instance.
duke@1: *
duke@1: * @return the int
for this SetOverrideType
instance.
duke@1: */
duke@1: public int value() {
duke@1: return _value;
duke@1: }
duke@1:
duke@1: /**
duke@1: * Converts the given int
to the corresponding
duke@1: * SetOverrideType
instance.
duke@1: *
duke@1: * @param i the int
to convert; must be either
duke@1: * SetOverrideType._SET_OVERRIDE
or
duke@1: * SetOverrideType._ADD_OVERRIDE
duke@1: * @return the SetOverrideType
instance whose value
duke@1: * matches the given int
duke@1: * @exception BAD_PARAM if the given int
does not
duke@1: * match the value of
duke@1: * any SetOverrideType
instance
duke@1: */
duke@1: public static SetOverrideType from_int(int i)
duke@1: {
duke@1: switch (i) {
duke@1: case _SET_OVERRIDE:
duke@1: return SET_OVERRIDE;
duke@1: case _ADD_OVERRIDE:
duke@1: return ADD_OVERRIDE;
duke@1: default:
duke@1: throw new org.omg.CORBA.BAD_PARAM();
duke@1: }
duke@1: }
duke@1:
duke@1: /**
duke@1: * Constructs a SetOverrideType
instance from an
duke@1: * int
.
duke@1: * @param _value must be either SET_OVERRIDE
or
duke@1: * ADD_OVERRIDE
duke@1: */
duke@1: protected SetOverrideType(int _value){
duke@1: this._value = _value;
duke@1: }
duke@1:
duke@1: /**
duke@1: * The field containing the value for this SetOverrideType
duke@1: * object.
duke@1: *
duke@1: */
duke@1: private int _value;
duke@1: }