Custom attribute writer method checking allowed values (enum).
 @param [Object] horizontal_alignment Object to be assigned
760207
def horizontal_alignment=(horizontal_alignment)
      validator = EnumAttributeValidator.new('String', ["Default", "None", "Left", "Center", "Right"])
      if horizontal_alignment.to_i == 0
        unless validator.valid?(horizontal_alignment)
          raise ArgumentError, "invalid value for 'horizontal_alignment', must be one of #{validator.allowable_values}."
        end
        @horizontal_alignment = horizontal_alignment
      else
        @horizontal_alignment = validator.allowable_values[horizontal_alignment.to_i]
      end
    end
20261
def bind_inum(column, enum_class, options = {})
      options = { prefix: column }.merge(options)
      options[:prefix] = options[:prefix] ? "#{options[:prefix]}_" : ''

      self.class_eval do
        define_method(column) do
          enum_class.parse(read_attribute(column))
        end

        define_method("#{column}=") do |value|
          enum_class.parse(value).tap do |enum|
            if enum
              write_attribute(column, enum.to_i)
            else
              write_attribute(column, nil)
            end
          end
        end

        enum_class.each do |enum|
          define_method("#{options[:prefix]}#{enum.to_s.underscore}?") do
            enum.eql?(read_attribute(column))
          end
        end
      end
    end
183373
def writeable_attributes(*attrs)
      @writeable_attributes ||= []
      if attrs.any?
        @writeable_attributes.map!(&:to_sym).concat(attrs).uniq! if attrs.any?
        setup_attributes(@writeable_attributes, false)
      end
      @writeable_attributes
    end
1126886
def eac3_lt_rt_center_mix_level=(eac3_lt_rt_center_mix_level)
      validator = EnumAttributeValidator.new('String', ["c0", "c1", "c2", "c3", "c4", "c5", "c6", "c7"])
      unless validator.valid?(eac3_lt_rt_center_mix_level)
        fail ArgumentError, "invalid value for 'eac3_lt_rt_center_mix_level', must be one of #{validator.allowable_values}."
      end
      @eac3_lt_rt_center_mix_level = eac3_lt_rt_center_mix_level
    end
272076
def _write_enums(self, entity_name, attributes):
        
        
        self.enum_attrs_for_locale[entity_name] = attributes;

        for attribute in attributes:
            enum_name = "%s%sEnum" % (entity_name, attribute.name[0].upper() + attribute.name[1:])
            self.enum_list.append(enum_name)
            filename = "%s%s.js" % (self._class_prefix, enum_name)
            self.write(destination = self.enum_directory,
                        filename=filename,
                        template_name="enum.js.tpl",
                        class_prefix = self._class_prefix,
                        enum_name = enum_name,
                        allowed_choices = set(attribute.allowed_choices))
563419
def validate_enum_attribute(fully_qualified_name: str, spec: Dict[str, Any], attribute: str,
                            candidates: Set[Union[str, int, float]]) -> Optional[InvalidValueError]:
    

    if attribute not in spec:
        return

    if spec[attribute] not in candidates:
        return InvalidValueError(fully_qualified_name, spec, attribute, candidates)
983475
def attachment_attributes_valid?
        [:size, :content_type].each do |attr_name|
          enum = attachment_options[attr_name]
          errors.add attr_name, I18n.translate("activerecord.errors.messages.inclusion", attr_name => enum) unless enum.nil? || enum.include?(send(attr_name))
        end
      end
952832
public void setAlignment(String alignment) {
        if (ElementTags.ALIGN_CENTER.equalsIgnoreCase(alignment)) {
            this.alignment = Element.ALIGN_CENTER;
            return;
        }
        if (ElementTags.ALIGN_RIGHT.equalsIgnoreCase(alignment)) {
            this.alignment = Element.ALIGN_RIGHT;
            return;
        }
        if (ElementTags.ALIGN_JUSTIFIED.equalsIgnoreCase(alignment)) {
            this.alignment = Element.ALIGN_JUSTIFIED;
            return;
        }
        if (ElementTags.ALIGN_JUSTIFIED_ALL.equalsIgnoreCase(alignment)) {
            this.alignment = Element.ALIGN_JUSTIFIED_ALL;
            return;
        }
        this.alignment = Element.ALIGN_LEFT;
    }
1103075
def _adjust_alignment(self, annotation):
        
        try:
            # annotation.xytext is depreciated in recent versions
            dx, dy = annotation.xyann
        except AttributeError:
            # but xyann doesn't exist in older versions...
            dx, dy = annotation.xytext

        horizontal = {1:'left', 0:'center', -1:'right'}[np.sign(dx)]
        vertical = {1:'bottom', 0:'center', -1:'top'}[np.sign(dy)]
        if not self._user_set_ha:
            annotation.set_horizontalalignment(horizontal)
        if not self._user_set_va:
            annotation.set_verticalalignment(vertical)
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
1093618
def entry_method=(entry_method)
      validator = EnumAttributeValidator.new('String', ["SWIPED", "KEYED", "EMV", "ON_FILE", "CONTACTLESS"])
      unless validator.valid?(entry_method)
        fail ArgumentError, "invalid value for 'entry_method', must be one of #{validator.allowable_values}."
      end
      @entry_method = entry_method
    end
561002
def _parse_alignment(alignment):
    

    align_flags = None
    for qt_align in alignment.split('|'):
        _, qt_align = qt_align.split('::')
        align = getattr(QtCore.Qt, qt_align)

        if align_flags is None:
            align_flags = align
        else:
            align_flags |= align

    return align_flags
796859
def selection_type=(selection_type)
      validator = EnumAttributeValidator.new('String', ["SINGLE", "MULTIPLE"])
      unless validator.valid?(selection_type)
        fail ArgumentError, "invalid value for 'selection_type', must be one of #{validator.allowable_values}."
      end
      @selection_type = selection_type
    end
349393
def horizontal_offset(self, value):
        

        if value is not None:
            assert type(value) is int, "'{0}' attribute: '{1}' type is not 'int'!".format("horizontal_offset", value)
        self.__horizontal_offset = value
477987
public void setAlignment(String alignment) {
        if (ElementTags.ALIGN_LEFT.equalsIgnoreCase(alignment)) {
            this.alignment = Element.ALIGN_LEFT;
            return;
        }
        if (ElementTags.RIGHT.equalsIgnoreCase(alignment)) {
            this.alignment = Element.ALIGN_RIGHT;
            return;
        }
        this.alignment = Element.ALIGN_CENTER;
    }
725251
def match_shifts_by=(match_shifts_by)
      validator = EnumAttributeValidator.new('String', ["START_AT", "END_AT", "INTERSECTION"])
      unless validator.valid?(match_shifts_by)
        fail ArgumentError, "invalid value for 'match_shifts_by', must be one of #{validator.allowable_values}."
      end
      @match_shifts_by = match_shifts_by
    end
1123292
def horizontal_headers(self, value):
        

        if value is not None:
            assert type(value) is OrderedDict, "'{0}' attribute: '{1}' type is not 'OrderedDict'!".format(
                "horizontal_headers", value)
        self.__horizontal_headers = value