Custom attribute writer method checking allowed values (enum).
 @param [Object] h264_level Object to be assigned
424102
def h264_level=(h264_level)
      validator = EnumAttributeValidator.new('String', ["1.0", "1b", "1.1", "1.2", "1.3", "2.0", "2.1", "2.2", "3.0", "3.1", "3.2", "4.0", "4.1", "4.2", "5.0", "5.1"])
      unless validator.valid?(h264_level)
        fail ArgumentError, "invalid value for 'h264_level', must be one of #{validator.allowable_values}."
      end
      @h264_level = h264_level
    end
1229814
def allowed_values(self):
        
        data = clips.data.DataObject(self._env)

        lib.EnvSlotAllowedValues(
            self._env, self._cls, self._name, data.byref)

        return tuple(data.value) if isinstance(data.value, list) else ()
934434
def valid_input?(input)
      case @attributes[:type]
      when :boolean
        [true,false].include?(input)
      when :enum
        raise MissingValuesError unless @attributes[:values]
        raise InvalidValuesError unless @attributes[:values].class == Array
        @attributes[:values].include?(input)
      when :string
        format = @attributes[:format] || :anything
        Validator.valid_input?(format, input)
      when :number
        [Integer, Fixnum].include?(input.class)
      when :timestamp
        # TODO timestamp pending
        # raise PendingBranchError
        true
      else
        false
      end
    end
384552
def avcintra_class=(avcintra_class)
      validator = EnumAttributeValidator.new('String', ["50", "100"])
      unless validator.valid?(avcintra_class)
        fail ArgumentError, "invalid value for 'avcintra_class', must be one of #{validator.allowable_values}."
      end
      @avcintra_class = avcintra_class
    end
853573
def document_type=(document_type)
      validator = EnumAttributeValidator.new('String', ["pdf", "xls", "xlsx"])
      unless validator.valid?(document_type)
        fail ArgumentError, "invalid value for 'document_type', must be one of #{validator.allowable_values}."
      end
      @document_type = document_type
    end
790389
def visibility=(visibility)
      validator = EnumAttributeValidator.new('String', ["PUBLIC", "PRIVATE"])
      unless validator.valid?(visibility)
        fail ArgumentError, "invalid value for 'visibility', must be one of #{validator.allowable_values}."
      end
      @visibility = visibility
    end
1033975
def eac3_analog_to_digital_converter_type=(eac3_analog_to_digital_converter_type)
      validator = EnumAttributeValidator.new('String', ["standard", "hdcd"])
      unless validator.valid?(eac3_analog_to_digital_converter_type)
        fail ArgumentError, "invalid value for 'eac3_analog_to_digital_converter_type', must be one of #{validator.allowable_values}."
      end
      @eac3_analog_to_digital_converter_type = eac3_analog_to_digital_converter_type
    end
487466
def playlist_type=(playlist_type)
      validator = EnumAttributeValidator.new('String', ["iframe", "iframe-only"])
      unless validator.valid?(playlist_type)
        fail ArgumentError, "invalid value for 'playlist_type', must be one of #{validator.allowable_values}."
      end
      @playlist_type = playlist_type
    end
194419
def match_type=(match_type)
      validator = EnumAttributeValidator.new('String', ["Exact", "StartsWith", "EndsWith", "Contains"])
      if match_type.to_i == 0
        unless validator.valid?(match_type)
          raise ArgumentError, "invalid value for 'match_type', must be one of #{validator.allowable_values}."
        end
        @match_type = match_type
      else
        @match_type = validator.allowable_values[match_type.to_i]
      end
    end
877296
def object_type=(object_type)
      validator = EnumAttributeValidator.new('String', ["ITEM", "DISCOUNT", "CATEGORY", "PLACEHOLDER"])
      unless validator.valid?(object_type)
        fail ArgumentError, "invalid value for 'object_type', must be one of #{validator.allowable_values}."
      end
      @object_type = object_type
    end
31612
def type=(type)
      allowed_values = ["lti1"]
      if type && !allowed_values.include?(type)
        fail ArgumentError, "invalid value for 'type', must be one of #{allowed_values}."
      end
      @type = type
    end
566057
def level=(new_val)
      return nil if @level == new_val
      raise JSS::InvalidDataError, "New value must be one of '#{LEVELS.join("' '")}'" unless LEVELS.include? new_val
      @level = new_val
      @need_to_update = true
    end
1142854
def validate(self, value, messages=None):
        
        valid     = True
        primitive = value

        def log(msg):
            if messages is not None:
                messages.append(msg)

        if self.enum:
            if value not in self.enum.values():
                valid = False
                flds = (self.name, str(value))
                log("%s value '%s' not in allowed enumerated values." % flds)
            else:
                primitive = int(self.enum.keys()[self.enum.values().index(value)])

        if self.type:
            if self.type.validate(primitive, messages, self.name) is False:
                valid = False

        return valid
1089054
def signature_implementation=(signature_implementation)
      validator = EnumAttributeValidator.new('String', ["TextStamp", "TextAsImage"])
      if signature_implementation.to_i == 0
        unless validator.valid?(signature_implementation)
          raise ArgumentError, "invalid value for 'signature_implementation', must be one of #{validator.allowable_values}."
        end
        @signature_implementation = signature_implementation
      else
        @signature_implementation = validator.allowable_values[signature_implementation.to_i]
      end
    end
7924
def valid?
      return false if @status.nil?
      status_validator = EnumAttributeValidator.new('String', ['error'])
      return false unless status_validator.valid?(@status)
      return false if @errors.nil?
      true
    end
987290
static void forceWritingEnumValue(
        VerboseXmlEncoder encoder, Object object)
    {
        Field valueToExpressionField = null;
        Field refsField = null;
        try
        {
            Class<?> encoderClass = encoder.getClass().getSuperclass();
            valueToExpressionField = 
                encoderClass.getDeclaredField("valueToExpression");
            valueToExpressionField.setAccessible(true);
            Object valueToExpressionObject = 
                valueToExpressionField.get(encoder);
            Map<?,?> valueToExpression = (Map<?,?>)valueToExpressionObject;
            Object valueData = valueToExpression.get(object);
            if (valueData != null)
            {
                Class<?> valueDataClass = valueData.getClass(); 
                refsField = valueDataClass.getDeclaredField("refs");
                refsField.setAccessible(true);
                refsField.setInt(valueData, 0);
            }
        }
        catch (NoSuchFieldException e)
        {
            logger.warning(e.toString());
        }
        catch (SecurityException e)
        {
            logger.warning(e.toString());
        }
        catch (IllegalArgumentException e)
        {
            logger.warning(e.toString());
        }
        catch (IllegalAccessException e)
        {
            logger.warning(e.toString());
        }
        finally
        {
            if (valueToExpressionField != null)
            {
                valueToExpressionField.setAccessible(false);
            }
            if (refsField != null)
            {
                refsField.setAccessible(false);
            }
        }
    }
1288012
def can_use_enum(func):
    

    @wraps(func)
    def inner(self, value):
        if isinstance(value, Enum):
            return self.check_value(value.value) or func(self, value.value)

        return func(self, value)

    return inner