1. /*
  2. * @(#)SetOverrideType.java 1.11 01/02/09
  3. *
  4. * Copyright 1998-2001 Sun Microsystems, Inc. All Rights Reserved.
  5. *
  6. * This software is the proprietary information of Sun Microsystems, Inc.
  7. * Use is subject to license terms.
  8. *
  9. */
  10. package org.omg.CORBA;
  11. /**
  12. * The mapping of a CORBA <code>enum</code> tagging
  13. * <code>SET_OVERRIDE</code> and <code>ADD_OVERRIDE</code>, which
  14. * indicate whether policies should replace the
  15. * existing policies of an <code>Object</code> or be added to them.
  16. * <P>
  17. * The method {@link omg.org.CORBA.Object._set_policy_override} takes
  18. * either <code>SetOverrideType.SET_OVERRIDE</code> or
  19. * <code>SetOverrideType.ADD_OVERRIDE</code> as its second argument.
  20. * The method <code>_set_policy_override</code>
  21. * creates a new <code>Object</code> initialized with the
  22. * <code>Policy</code> objects supplied as the first argument. If the
  23. * second argument is <code>ADD_OVERRIDE</code>, the new policies
  24. * are added to those of the <code>Object</code> instance that is
  25. * calling the <code>_set_policy_override</code> method. If
  26. * <code>SET_OVERRIDE</code> is given instead, the existing policies
  27. * are replaced with the given ones.
  28. *
  29. * @author OMG
  30. * @version 1.12 09/20/00
  31. * @since JDK1.2
  32. */
  33. public class SetOverrideType implements org.omg.CORBA.portable.IDLEntity {
  34. /**
  35. * The <code>int</code> constant for the enum value SET_OVERRIDE.
  36. */
  37. public static final int _SET_OVERRIDE = 0;
  38. /**
  39. * The <code>int</code> constant for the enum value ADD_OVERRIDE.
  40. */
  41. public static final int _ADD_OVERRIDE = 1;
  42. /**
  43. * The <code>SetOverrideType</code> constant for the enum value SET_OVERRIDE.
  44. */
  45. public static final SetOverrideType SET_OVERRIDE = new SetOverrideType(_SET_OVERRIDE);
  46. /**
  47. * The <code>SetOverrideType</code> constant for the enum value ADD_OVERRIDE.
  48. */
  49. public static final SetOverrideType ADD_OVERRIDE = new SetOverrideType(_ADD_OVERRIDE);
  50. /**
  51. * Retrieves the value of this <code>SetOverrideType</code> instance.
  52. *
  53. * @return the <code>int</code> for this <code>SetOverrideType</code> instance.
  54. */
  55. public int value() {
  56. return _value;
  57. }
  58. /**
  59. * Converts the given <code>int</code> to the corresponding
  60. * <code>SetOverrideType</code> instance.
  61. *
  62. * @param i the <code>int</code> to convert. It must be one of
  63. * the <code>int</code> constants in the class
  64. * <code>SetOverrideType</code>.
  65. * @return the <code>SetOverrideType</code> instance whose value
  66. * matches the given <code>int</code>
  67. * @exception BAD_PARAM if the given <code>int</code> does not
  68. * match the value of
  69. * any <code>SetOverrideType</code> instance
  70. */
  71. public static SetOverrideType from_int(int i) throws org.omg.CORBA.BAD_PARAM
  72. {
  73. switch (i) {
  74. case _SET_OVERRIDE:
  75. return SET_OVERRIDE;
  76. case _ADD_OVERRIDE:
  77. return ADD_OVERRIDE;
  78. default:
  79. throw new org.omg.CORBA.BAD_PARAM();
  80. }
  81. }
  82. /**
  83. * Constructs the <code>SetOverrideType</code> instance given a
  84. * <code>int</code>.
  85. * @param _value the value that is passed in could be one of
  86. * SET_OVERRIDE or ADD_OVERRIDE
  87. */
  88. protected SetOverrideType(int _value){
  89. this._value = _value;
  90. }
  91. private int _value;
  92. }