Custom attribute writer method with validation
 @param [Object] receivable_id Value to be assigned
500594
def receivable_id=(receivable_id)
      if receivable_id.nil?
        fail ArgumentError, "receivable_id cannot be nil"
      end

      if receivable_id.to_s.length < 1
        fail ArgumentError, "invalid value for 'receivable_id', the character length must be great than or equal to 1."
      end

      @receivable_id = receivable_id
    end
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
764881
public static void validateServiceInstanceID(String id) throws ServiceException {
        if (!validateRequiredField(id, idRegEx)) {
            throw new ServiceException(
                    ErrorCode.SERVICE_INSTANCE_ID_FORMAT_ERROR);
        }
    }
1275708
def account_type=(account_type)
      validator = EnumAttributeValidator.new('String', ["LOCATION", "BUSINESS"])
      unless validator.valid?(account_type)
        fail ArgumentError, "invalid value for 'account_type', must be one of #{validator.allowable_values}."
      end
      @account_type = account_type
    end
1193331
def id=(id)

      if !id.nil? && id.to_s.length > 255
        fail ArgumentError, "invalid value for 'id', the character length must be smaller than or equal to 255."
      end

      @id = id
    end
828823
function(model, value, attr) {
      var indices, validators,
        validations = model.validation ? _.result(model, 'validation') || {} : {};
      // If the validations hash contains an entry for the attr
      if (_.contains(_.keys(validations), attr)) {
        return validateAttrWithOpenArray(model, attr, value, _.extend({}, model.attributes));
      } else {
        indices = extractIndices(attr);
        attr = stripIndices(attr);
        validators = getValidators(model, attr);
        return invokeValidator(validators, model, value, attr, _.extend({}, model.attributes), indices);
      }
    }
817795
def modifier_list_id=(modifier_list_id)
      if modifier_list_id.nil?
        fail ArgumentError, "modifier_list_id cannot be nil"
      end

      if modifier_list_id.to_s.length < 1
        fail ArgumentError, "invalid value for 'modifier_list_id', the character length must be great than or equal to 1."
      end

      @modifier_list_id = modifier_list_id
    end
143498
def validate_object_id(object_id):
    
    result = re.match(OBJECT_ID_RE, str(object_id))
    if not result:
        print("'%s' appears not to be a valid 990 object_id" % object_id)
        raise RuntimeError(OBJECT_ID_MSG)
    return object_id
793296
def method_missing(meth, *args)
      m = meth.id2name
      if m =~ /=$/
        @attributes[m.chop.to_sym] = (args.length < 2 ? args[0] : args)
      else
        @attributes[m.to_sym]
      end
    end
529131
def association_valid?(reflection, record, index = nil)
        return true if record.destroyed? || (reflection.options[:autosave] && record.marked_for_destruction?)

        context = validation_context unless [:create, :update].include?(validation_context)

        unless valid = record.valid?(context)
          if reflection.options[:autosave]
            indexed_attribute = !index.nil? && (reflection.options[:index_errors] || ActiveRecord::Base.index_nested_attribute_errors)

            record.errors.group_by_attribute.each { |attribute, errors|
              attribute = normalize_reflection_attribute(indexed_attribute, reflection, index, attribute)

              errors.each { |error|
                self.errors.import(
                  error,
                  attribute: attribute
                )
              }
            }
          else
            errors.add(reflection.name)
          end
        end
        valid
      end
1371126
def placeholder_type=(placeholder_type)
      validator = EnumAttributeValidator.new('String', ["ALL_ITEMS", "DISCOUNTS_CATEGORY", "REWARDS_FINDER"])
      unless validator.valid?(placeholder_type)
        fail ArgumentError, "invalid value for 'placeholder_type', must be one of #{validator.allowable_values}."
      end
      @placeholder_type = placeholder_type
    end
1266814
def customer_id=(customer_id)

      if !customer_id.nil? && customer_id.to_s.length > 50
        fail ArgumentError, "invalid value for 'customer_id', the character length must be smaller than or equal to 50."
      end

      @customer_id = customer_id
    end
30574
protected void storeValidation(Validation v, XMLStreamWriter writer) throws Exception
   {
      writer.writeStartElement(XML.ELEMENT_VALIDATION);

      if (v.getValidConnectionChecker() != null)
      {
         storeExtension(v.getValidConnectionChecker(), writer, XML.ELEMENT_VALID_CONNECTION_CHECKER);
      }

      if (v.getCheckValidConnectionSql() != null)
      {
         writer.writeStartElement(XML.ELEMENT_CHECK_VALID_CONNECTION_SQL);
         writer.writeCharacters(v.getValue(XML.ELEMENT_CHECK_VALID_CONNECTION_SQL, v.getCheckValidConnectionSql()));
         writer.writeEndElement();
      }

      if (v.isValidateOnMatch() != null)
      {
         writer.writeStartElement(XML.ELEMENT_VALIDATE_ON_MATCH);
         writer.writeCharacters(v.getValue(XML.ELEMENT_VALIDATE_ON_MATCH, v.isValidateOnMatch().toString()));
         writer.writeEndElement();
      }

      if (v.isBackgroundValidation() != null)
      {
         writer.writeStartElement(XML.ELEMENT_BACKGROUND_VALIDATION);
         writer.writeCharacters(v.getValue(XML.ELEMENT_BACKGROUND_VALIDATION, v.isBackgroundValidation().toString()));
         writer.writeEndElement();
      }

      if (v.getBackgroundValidationMillis() != null)
      {
         writer.writeStartElement(XML.ELEMENT_BACKGROUND_VALIDATION_MILLIS);
         writer.writeCharacters(v.getValue(XML.ELEMENT_BACKGROUND_VALIDATION_MILLIS,
                                           v.getBackgroundValidationMillis().toString()));
         writer.writeEndElement();
      }

      if (v.isUseFastFail() != null)
      {
         writer.writeStartElement(XML.ELEMENT_USE_FAST_FAIL);
         writer.writeCharacters(v.getValue(XML.ELEMENT_USE_FAST_FAIL, v.isUseFastFail().toString()));
         writer.writeEndElement();
      }

      if (v.getStaleConnectionChecker() != null)
      {
         storeExtension(v.getStaleConnectionChecker(), writer, XML.ELEMENT_STALE_CONNECTION_CHECKER);
      }

      if (v.getExceptionSorter() != null)
      {
         storeExtension(v.getExceptionSorter(), writer, XML.ELEMENT_EXCEPTION_SORTER);
      }

      writer.writeEndElement();
   }
212649
protected void storeValidation(Validation v, XMLStreamWriter writer) throws Exception
   {
      writer.writeStartElement(CommonXML.ELEMENT_VALIDATION);

      if (v.isValidateOnMatch() != null)
      {
         writer.writeStartElement(CommonXML.ELEMENT_VALIDATE_ON_MATCH);
         writer.writeCharacters(v.getValue(CommonXML.ELEMENT_VALIDATE_ON_MATCH, v.isValidateOnMatch().toString()));
         writer.writeEndElement();
      }

      if (v.isBackgroundValidation() != null)
      {
         writer.writeStartElement(CommonXML.ELEMENT_BACKGROUND_VALIDATION);
         writer.writeCharacters(v.getValue(CommonXML.ELEMENT_BACKGROUND_VALIDATION,
                                           v.isBackgroundValidation().toString()));
         writer.writeEndElement();
      }

      if (v.getBackgroundValidationMillis() != null)
      {
         writer.writeStartElement(CommonXML.ELEMENT_BACKGROUND_VALIDATION_MILLIS);
         writer.writeCharacters(v.getValue(CommonXML.ELEMENT_BACKGROUND_VALIDATION_MILLIS,
                                           v.getBackgroundValidationMillis().toString()));
         writer.writeEndElement();
      }

      if (v.isUseFastFail() != null)
      {
         writer.writeStartElement(CommonXML.ELEMENT_USE_FAST_FAIL);
         writer.writeCharacters(v.getValue(CommonXML.ELEMENT_USE_FAST_FAIL, v.isUseFastFail().toString()));
         writer.writeEndElement();
      }

      writer.writeEndElement();
   }
7316
def valid?
      return false if @payment_id.nil?
      return false if @type.nil?
      type_validator = EnumAttributeValidator.new('String', ["FULL", "PARTIAL"])
      return false unless type_validator.valid?(@type)
      return false if @reason.nil?
      return true
    end
615635
def validate_attr(resource_attr_id, scenario_id, template_id=None):
    
    rs = db.DBSession.query(ResourceScenario).\
                        filter(ResourceScenario.resource_attr_id==resource_attr_id,
        ResourceScenario.scenario_id==scenario_id).options(
        joinedload_all("resourceattr")).options(
        joinedload_all("dataset")
        ).one()

    error = None

    try:
        _do_validate_resourcescenario(rs, template_id)
    except HydraError as e:

        error = JSONObject(dict(
                 ref_key = rs.resourceattr.ref_key,
                 ref_id  = rs.resourceattr.get_resource_id(),
                 ref_name = rs.resourceattr.get_resource().get_name(),
                 resource_attr_id = rs.resource_attr_id,
                 attr_id          = rs.resourceattr.attr.id,
                 attr_name        = rs.resourceattr.attr.name,
                 dataset_id       = rs.dataset_id,
                 scenario_id=scenario_id,
                 template_id=template_id,
                 error_text=e.args[0]))
    return error
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