Validate {@code keys} attribute
186798
private void validateKeys(final Attributes atts) {
        final String keys = atts.getValue(ATTRIBUTE_NAME_KEYS);
        if (keys != null) {
            for (final String key : keys.split(" ")) {
                if (!isValidKeyName(key)) {
                    logger.error(MessageUtils.getMessage("DOTJ055E", key).toString());
                }
            }
        }
    }
718062
public void validateAttributes(Collection<String> attributes) throws CompatibilityException {
                Validate.notNull(attributes);
                for (String attribute : attributes) {
                        validateAttribute(attribute);
                }
        }
222573
@Override
    public void validate() throws ConfigurationException {
        if (host == null || host.length() == 0) {
            this.host = "localhost";
        }
        if (port == null || port.length() == 0) {
            this.port = "12345";
        }
    }
651574
private int checkKey(Object key) {
	if (key == null) {
	    throw new NullPointerException("key cannot be null");
	} else if (!(key instanceof Integer)) {
	    throw new IllegalArgumentException("key must be an Integer");
	}
	else {
	    return ((Integer)key).intValue();
	}
    }
712015
private void validateAttributeValues(final String qName, final Attributes atts) {
        if (validateMap.isEmpty()) {
            return;
        }
        for (int i = 0; i < atts.getLength(); i++) {
            final QName attrName = new QName(atts.getURI(i), atts.getLocalName(i));
            final Map<String, Set<String>> valueMap = validateMap.get(attrName);
            if (valueMap != null) {
                Set<String> valueSet = valueMap.get(qName);
                if (valueSet == null) {
                    valueSet = valueMap.get("*");
                }
                if (valueSet != null) {
                    final String attrValue = atts.getValue(i);
                    final String[] keylist = attrValue.trim().split("\\s+");
                    for (final String s : keylist) {
                        if (!StringUtils.isEmptyString(s) && !valueSet.contains(s)) {
                            logger.warn(MessageUtils.getMessage("DOTJ049W",
                                    attrName.toString(), qName, attrValue, StringUtils.join(valueSet, COMMA)).toString());
                        }
                    }
                }
            }
        }
    }
400995
def validate_key(key)
      unless key.is_a?(Symbol) || key.is_a?(String)
        raise ArgumentError, 'Key must be a string or symbol'
      end
      key
    end
788639
function validatePropertyKey(name, element, parentType) {
  if (!NUMERIC_PROPERTY_REGEX.test(name)) {
    return;
  }
  warnAndMonitorForKeyUse(
    'Child objects should have non-numeric keys so ordering is preserved.',
    element,
    parentType
  );
}
1111087
function validate(key, values) {
  if(this.arity > 0 && values.length !== this.arity) {
    throw new TypeDefError(
      util.format('bad arity for \'%s\', expected %s got %s',
        key, this.arity, values.length));
  }
  var types = Array.isArray(this.type) ? this.type : [this.type]
    , i
    , type
    , val
    , num
    , coerced = []
    , enumerable = false;

  for(i = 0;i < types.length;i++) {
    type = types[i];
    val = values[i];
    enumerable = Array.isArray(type);
    if(enumerable) {
      if(!~type.indexOf(val)) {
        throw new TypeDefError(
          util.format('enum error on key \'%s\', got \'%s\' expected one of %s',
            key, val, type.join(', ')));
      }
    }
    switch(type) {
      case ByteSize:
        val = ByteSize.parse(val);
        break;
      case Boolean:
        if(val !== YES && val !== NO) {
          throw new Error(
            util.format('argument must be \'%s\' or \'%s\'', YES, NO));
        }
        val = val === YES ? true : false;
        break;
      case String:
        // strings can be quoted
        val = val.replace(/^"/, '').replace(/"$/, '');
        break;
      case Number:
        num = parseInt(val);
        if(isNaN(num) || !/^-?[0-9]+$/.test(val)) {
          throw new TypeDefError(
            util.format('number expected for \'%s\', got %s', key, val));
        }
        val = num;
        break;
    }

    coerced[i] = val;
  }
  if(this.arity === 1 && !this.repeats) return coerced[0];
  return Array.isArray(this.type) ? coerced : coerced[0];
}
303672
public <T> B attr(AttributeKey<T> key, T value) {
        if (key == null) {
            throw new NullPointerException("key");
        }
        if (value == null) {
            synchronized (attrs) {
                attrs.remove(key);
            }
        } else {
            synchronized (attrs) {
                attrs.put(key, value);
            }
        }
        return self();
    }
737705
function validateObject(node, schema, key) {
    if (typeof node == "object") {
      try {
        validateModel(node, schema[SCHEMADATA]);
      } catch (e) {
        throw new ValidationException(e.message + " at " + key + ".");
      }
    } else {
      throw new ValidationException("Expected object for " + key);
    }
  }
1031165
private static void validateMappedBy(Attribute attr, Attribute mappedByAttr) {
    if (mappedByAttr != null) {
      if (!isSingleReferenceType(mappedByAttr)) {
        throw new MolgenisDataException(
            format(
                "Invalid mappedBy attribute [%s] data type [%s].",
                mappedByAttr.getName(), mappedByAttr.getDataType()));
      }

      Attribute refAttr = attr.getRefEntity().getAttribute(mappedByAttr.getName());
      if (refAttr == null) {
        throw new MolgenisDataException(
            format(
                "mappedBy attribute [%s] is not part of entity [%s].",
                mappedByAttr.getName(), attr.getRefEntity().getId()));
      }
    }
  }
349680
def _validate(self):
        
        for key in self:
            if key not in DEFAULTS:
                raise exceptions.ConfigurationException(
                    'Unknown configuration key "{}"! Valid configuration keys are'
                    " {}".format(key, list(DEFAULTS.keys()))
                )

        validate_queues(self["queues"])
        validate_bindings(self["bindings"])
        validate_client_properties(self["client_properties"])
177338
@Override
    public boolean contains(AttributeKey<?> key) {

        if (this.internals.containsKey(key.name())) {
            return true;
        }

        return this.attributes.contains(key);

    }
598385
public Elements getElementsByAttribute(String key) {
        Validate.notEmpty(key);
        key = key.trim();

        return Collector.collect(new Evaluator.Attribute(key), this);
    }
1214266
def validate(key):
    
    if not isinstance(key, (str, bytes)):
        raise KeyError('Key must be of type str or bytes, found type {}'.format(type(key)))
361147
def validate_key(key: str):
        
        if "//" in key:
            raise DoubleSlashKeyError(key)
        elif normpath(key) != key:
            raise NonNormalisedKeyError(key)
230193
function validateProp(key, value) {
  const type = typeof value;

  switch (key) {
  case 'orderByKey':
  case 'orderByPriority':
  case 'orderByValue':
    if (!value) {
      throw new Error(`"query.${key}" should not be set to false. Set it off by setting an other order.`);
    }
    break;

  case 'orderByChild':
    if (value == null) {
      throw new Error('"query.orderByChild" should not be set to null. Set it off by setting an other order.');
    }
    if (type !== 'string') {
      throw new Error('"query.orderByChild" should be a string or null.');
    }
    break;

  case 'startAt':
  case 'endAt':
  case 'equalTo':
    if (
      value !== null &&
      type !== 'string' &&
      type !== 'number' &&
      type !== 'boolean'
    ) {
      throw new Error(`query.${key} should be a string, a number, a boolean or null.`);
    }
    break;

  case 'limitToFirst':
  case 'limitToLast':
    if (value != null && type !== 'number') {
      throw new Error(`query.${key} should be a number or null.`);
    }
    break;

  default:
    throw new Error(`"${key}" is not a query parameter.`);
  }
}