Add a validation object. A key is required that can be used to retrieve the validation object.

@param key key used to retrieve the validation object
@param validation validation object
963267
public void addValidation(Object key, Validation validation){
        initMapOnce();
        validations.put(key, validation);
        // update aggregated value
        passedAll = passedAll && validation.passed();
    }
628654
@SuppressWarnings("unchecked")
    public M with(final String key, final short value) {
        validate(key, value);
        data.putValue(key, value);
        return (M) this;
    }
1285827
public int addKey(String key) {
        JdkUtils.requireNonNull(key);
        int nextIndex = keys.size();
        final Integer mapIndex = JdkUtils.putIfAbsent(keys, key, nextIndex);
        return mapIndex == null ? nextIndex : mapIndex;
    }
727027
public void addValidationError(String message) {
        messages.add(new UIMessageDTO(message, null, UIMessage.Severity.ERROR));
        valid = false;
        canExecute = false;
    }
13818
private void fail(final K key) {
        final String methodName = "fail(): ";
        stateLock.writeLock().lock();
        try {
            Integer index = actualIndices.remove(key);
            if (index == null)
                throw new IllegalArgumentException("unknown key: " + key);
            elements[index] = FAILED;
            // register that this key failed
            (failedKeys == null ? failedKeys = new ArrayList<K>(actualIndices.size() + 1) : failedKeys).add(key);
            checkForCompletion();
            if (tc.isDebugEnabled())
                Tr.debug(tc, methodName, "permanent fail for key " + key);
            stateLock.postEvent();
        } finally {
            stateLock.writeLock().unlock();
        }
    }
1073362
public synchronized void add(GenericKeys key) {
        KeyBucket bucket = makeBucket(key.getName().charAt(0));
        if (null != bucket) {
            bucket.add(key);
        }
    }
999142
public void add(ValidationResultsModel validationResultsModel) {
		if (children.add(validationResultsModel)) {
			validationResultsModel.addValidationListener(this);
			validationResultsModel.addPropertyChangeListener(HAS_ERRORS_PROPERTY, this);
			validationResultsModel.addPropertyChangeListener(HAS_WARNINGS_PROPERTY, this);
			validationResultsModel.addPropertyChangeListener(HAS_INFO_PROPERTY, this);
			if ((validationResultsModel.getMessageCount() > 0))
				fireChangedEvents();
		}
	}
674198
private function add_validator_to_stack( $validator, $key, $error_message = NULL ) {

		$options = [ ];

		if ( is_array( $validator ) && isset( $validator[ 'validator' ] ) ) {
			isset( $validator[ 'options' ] ) and $options = (array) $validator[ 'options' ];
			$validator = $validator[ 'validator' ];
		}

		$validator = $this->validator_factory->create( $validator, $options );

		isset( $this->validators[ $key ] ) or $this->validators[ $key ] = new \SplObjectStorage();
		$this->validators[ $key ]->attach( $validator, $error_message );

		return $this;

	}
437068
public void add(final Param key, final Integer value) {
        if (value != null && value > 0) {
            parameters.put(key, String.valueOf(value));
        }
    }
1174859
public void addAttribute(String key, Object value) {
        Objects.requireNonNull(key, Required.KEY.toString());
        this.attributes.put(key, value);
    }
352980
def validate_key(self, key):
        
        if not key:
            name = self.__class__.__name__
            msg = "%s response missing %s" % (name, self.key_name)
            raise ValidationException(msg, self)
        elif not isinstance(key, str):
            msg = "Response contains invalid %s type" % self.key_name
            raise ValidationException(msg, type(key))
849038
@SuppressWarnings("unchecked")
    private void validateKey(int index) {
        final int size = (index + 1);
        if (null == this.keys) {
            // nothing has been created yet
            this.keys = (K[]) new Object[size];
        } else if (index >= this.keys.length) {
            // this row puts us beyond the current storage
            Object[] newKeys = new Object[size];
            System.arraycopy(this.keys, 0, newKeys, 0, this.keys.length);
            this.keys = (K[]) newKeys;
        }
    }
1171310
public void addForeigerKey(String key) {
    String[] foreigers = new String[foreigerKeys.length + 1];
    int i = 0;
    for (; i < foreigerKeys.length; i++) {
      foreigers[i] = foreigerKeys[i];
    }
    foreigers[i] = key;
    foreigerKeys = foreigers;
  }
1264470
public void removeKey(String key) {
        if (key != null && !key.isEmpty()) {
            for (int i=0; i<map.size(); i++) {
                KeyValue kv = map.get(i);
                if (key.equals(kv.getKey())) {
                    map.remove(i);
                    return;
                }
            }
        }
    }
162734
public static <T> void validate(Request<T> request) throws ValidationConstraintViolationException {
		if (request != null) {
			Class<?> clazz = request.getClass();
			List<ConstraintViolation> leafs = new LinkedList<ConstraintViolation>();

			Field[] fields = clazz.getDeclaredFields();
			for (Field field : fields) {
				if (null != field.getAnnotation(Required.class)) {

					field.setAccessible(true);
					Object value = null;
					try {
						value = field.get(request);
					} catch (Exception e) {
						// not cool...
						throw new ValidationConstraintViolationException(e);
					}

					if (value == null || value instanceof String && ((String) value).isEmpty()) {
						ConstraintViolation violation = ConstraintViolation.newConstraintViolation("@" + Required.class.getSimpleName(), field);
						leafs.add(violation);
					}
				}
			}

			if (!leafs.isEmpty()) {
				throw new ValidationConstraintViolationException(preMessage, leafs);
			}
		}
	}
758119
@JsOverlay
  public final void addJavaPropValidator(Function javaMethod, String propertyName) {
    PropOptions propDefinition = getProps().get(propertyName);
    propDefinition.validator = javaMethod;
  }
1206312
public void add(ValidationResult validation) {
    correct &= validation.correct;
    if (!validate) return;
    errors.addAll(validation.errors);
    warnings.addAll(validation.warnings);
  }