alvinalexander.com | career | drupal | java | mac | mysql | perl | scala | uml | unix  

Java example source code file (SetOverrideType.java)

This example Java source code file (SetOverrideType.java) is included in the alvinalexander.com "Java Source Code Warehouse" project. The intent of this project is to help you "Learn Java by Example" TM.

Learn more about this Java project at its project page.

Java - Java tags/keywords

add_override, set_override, setoverridetype

The SetOverrideType.java Java example source code

/*
 * Copyright (c) 1998, 2010, Oracle and/or its affiliates. All rights reserved.
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 *
 * This code is free software; you can redistribute it and/or modify it
 * under the terms of the GNU General Public License version 2 only, as
 * published by the Free Software Foundation.  Oracle designates this
 * particular file as subject to the "Classpath" exception as provided
 * by Oracle in the LICENSE file that accompanied this code.
 *
 * This code is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
 * version 2 for more details (a copy is included in the LICENSE file that
 * accompanied this code).
 *
 * You should have received a copy of the GNU General Public License version
 * 2 along with this work; if not, write to the Free Software Foundation,
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
 *
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
 * or visit www.oracle.com if you need additional information or have any
 * questions.
 */

package org.omg.CORBA;

/**
 * The mapping of a CORBA <code>enum tagging
 * <code>SET_OVERRIDE and ADD_OVERRIDE, which
 * indicate whether policies should replace the
 * existing policies of an <code>Object or be added to them.
 * <P>
 * The method {@link org.omg.CORBA.Object#_set_policy_override} takes
 * either <code>SetOverrideType.SET_OVERRIDE or
 * <code>SetOverrideType.ADD_OVERRIDE as its second argument.
 * The method <code>_set_policy_override
 * creates a new <code>Object initialized with the
 * <code>Policy objects supplied as the first argument.  If the
 * second argument is <code>ADD_OVERRIDE, the new policies
 * are added to those of the <code>Object instance that is
 * calling the <code>_set_policy_override method.  If
 * <code>SET_OVERRIDE is given instead, the existing policies
 * are replaced with the given ones.
 *
 * @author OMG
 * @since   JDK1.2
 */

public class SetOverrideType implements org.omg.CORBA.portable.IDLEntity {

    /**
     * The <code>int constant for the enum value SET_OVERRIDE.
     */
    public static final int _SET_OVERRIDE = 0;

    /**
     * The <code>int constant for the enum value ADD_OVERRIDE.
     */
    public static final int _ADD_OVERRIDE = 1;

    /**
     * The <code>SetOverrideType constant for the enum value SET_OVERRIDE.
     */
    public static final SetOverrideType SET_OVERRIDE = new SetOverrideType(_SET_OVERRIDE);

    /**
     * The <code>SetOverrideType constant for the enum value ADD_OVERRIDE.
     */
    public static final SetOverrideType ADD_OVERRIDE = new SetOverrideType(_ADD_OVERRIDE);

    /**
     * Retrieves the value of this <code>SetOverrideType instance.
     *
     * @return  the <code>int for this SetOverrideType instance.
     */
    public int value() {
        return _value;
    }

    /**
     * Converts the given <code>int to the corresponding
     * <code>SetOverrideType instance.
     *
     * @param  i the <code>int to convert; must be either
     *         <code>SetOverrideType._SET_OVERRIDE or
     *         <code>SetOverrideType._ADD_OVERRIDE
     * @return  the <code>SetOverrideType instance whose value
     *       matches the given <code>int
     * @exception  BAD_PARAM  if the given <code>int does not
     *       match the value of
     *       any <code>SetOverrideType instance
     */
    public static SetOverrideType from_int(int i)
    {
        switch (i) {
        case _SET_OVERRIDE:
            return SET_OVERRIDE;
        case _ADD_OVERRIDE:
            return ADD_OVERRIDE;
        default:
            throw new org.omg.CORBA.BAD_PARAM();
        }
    }

    /**
     * Constructs a <code>SetOverrideType instance from an
     * <code>int.
     * @param _value must be either <code>SET_OVERRIDE or
     *        <code>ADD_OVERRIDE
     */
    protected SetOverrideType(int _value){
        this._value = _value;
    }

    /**
     * The field containing the value for this <code>SetOverrideType
     * object.
     *
     */
    private int _value;
}

Other Java examples (source code examples)

Here is a short list of links related to this Java SetOverrideType.java source code file:

... this post is sponsored by my books ...

#1 New Release!

FP Best Seller

 

new blog posts

 

Copyright 1998-2021 Alvin Alexander, alvinalexander.com
All Rights Reserved.

A percentage of advertising revenue from
pages under the /java/jwarehouse URI on this website is
paid back to open source projects.