Ensure that each field is within its valid range by calling {@link
#validateField(int)} on each field that has been set.  This method
should only be called if this calendar is not lenient.
@see #isLenient
@see #validateField(int)
432413
protected void validateFields() {
        for (int field = 0; field < fields.length; field++) {
            if (stamp[field] >= MINIMUM_USER_STAMP) {
                validateField(field);
            }
        }
    }
217455
public final void set(int field, int value)
    {
        if (areFieldsVirtuallySet) {
            computeFields();
        }
        fields[field] = value;
        /* Ensure that the fNextStamp value doesn't go pass max value for 32 bit integer */
        if (nextStamp == STAMP_MAX) {
            recalculateStamp();
        }
        stamp[field] = nextStamp++;
        isTimeSet = areFieldsSet = areFieldsVirtuallySet = false;
    }
903726
@SuppressWarnings({ "rawtypes", "unchecked" })
  void complete() {

    if (this.range != null) {
      AbstractValidatorRange validator = null;
      if (this.valueType != null) {
        Class<?> valueClass = this.valueType.getAssignmentClass();
        if (this.valueType.isCollection()) {
          validator = new ValidatorCollectionSize(this.range);
        } else if (this.valueType.isMap()) {
          validator = new ValidatorMapSize(this.range);
        } else if (this.valueType.getComponentType() != null) {
          validator = new ValidatorArrayLength(this.range);
        } else if (this.mathUtil.getNumberType(valueClass) != null) {
          validator = new ValidatorRange<>(this.range);
        }
      }
      if (validator == null) {
        validator = new ValidatorRangeGeneric<>(this.range);
      }
      this.validatorRegistry.add(validator);
    }
  }
697427
@SuppressWarnings("unchecked")
	private static ValidationFail performFieldValidations(Context context, FieldInfo fieldInfo, View view) {
		// first, we need to check if condition is not applied for all validations on field
		if (fieldInfo.condition != null && fieldInfo.condition.validationAnnotation().equals(Condition.class)) {
			// condition is applied to all validations on field
			boolean evaluation = evaluateCondition(view, fieldInfo.condition);
			if (! evaluation) {
				// go to next field
				return null;
			}
		}

		// field validations
		for (ValidationInfo valInfo : fieldInfo.validationInfoList) {
			final Annotation annotation = valInfo.annotation;
			if (fieldInfo.condition != null && fieldInfo.condition.validationAnnotation().equals(annotation.annotationType())) {
				boolean evaluation = evaluateCondition(view, fieldInfo.condition);

				if (! evaluation) {
					// continue to next annotation
					continue;
				}
			}
			final IFieldAdapter adapter = FieldAdapterFactory.getAdapterForField(view, annotation);
			if (adapter == null) {
				throw new NoFieldAdapterException(view, annotation);
			}

			final Object value = adapter.getFieldValue(annotation, view);
			final boolean isValid = valInfo.validator.validate(annotation, value);

			if (! isValid) {
				final String message = valInfo.validator.getMessage(context, annotation, value);
				final int order = valInfo.validator.getOrder(annotation);

				// no more validations on this field
				return new ValidationFail(view, message, order);
			}
		}
		return null;
	}
516284
protected boolean mightBeValidatorAnnotated() {
        for (ActionFormProperty property : propertyMap.values()) {
            final Field field = property.getPropertyDesc().getField();
            if (field == null) { // not field property
                continue;
            }
            for (Annotation anno : field.getAnnotations()) {
                if (isValidatorAnnotation(anno.annotationType())) {
                    return true; // first level only
                }
            }
        }
        return false;
    }
208995
function() {
      
      var v = this.getValue(), str_value = inputEx.IntegerField.superclass.getValue.call(this);
      
      // empty field
      if (v === '') {
         // validate only if not required
         return !this.options.required;
      }
      
      if (isNaN(v)) {
         return false;
      }
      
      return !!str_value.match(/^[\+\-]?[0-9]+$/) && (this.options.negative ? true : v >= 0) && v >= this.options.min && v <= this.options.max;
      
   }
1334254
function validateField(field, cb) {
        if (_.isArray(field.validation)) {
            async.each(field.validation, performValidation(field), function(err) {
                cb(err);
            });
        } else {
            cb();
        }
    }
475226
def validateField(cls, fieldName, value) :
        
        try :
            valValue = Collection.validateField(fieldName, value)
        except SchemaViolation as e:
            if fieldName == "_from" or fieldName == "_to" :
                return True
            else :
                raise e
        return valValue
68176
@Override
    public void validate() throws Exception {
        super.validate();
        this.parse();
        Assert.assertTrue(
                String.format(
                        "Lower bound %d should be less than upper bound %d",
                        lower,
                        upper),
                lower <= upper);
        Assert.assertFalse(
                "The range is empty",
                !this.includeLower
                    && !this.includeUpper
                    && (this.upper - this.lower) <= 1);
        Assert.assertFalse(
                "The range is empty",
                !(this.includeLower && this.includeUpper)
                    && (this.upper - this.lower) < 1);
    }
958973
@Override
    public void validate(ByteBuffer bytes) throws MarshalException
    {
        ByteBuffer input = bytes.duplicate();
        for (int i = 0; i < size(); i++)
        {
            // we allow the input to have less fields than declared so as to support field addition.
            if (!input.hasRemaining())
                return;

            if (input.remaining() < 4)
                throw new MarshalException(String.format("Not enough bytes to read size of %dth field %s", i, fieldName(i)));

            int size = input.getInt();

            // size < 0 means null value
            if (size < 0)
                continue;

            if (input.remaining() < size)
                throw new MarshalException(String.format("Not enough bytes to read %dth field %s", i, fieldName(i)));

            ByteBuffer field = ByteBufferUtil.readBytes(input, size);
            types.get(i).validate(field);
        }

        // We're allowed to get less fields than declared, but not more
        if (input.hasRemaining())
            throw new MarshalException("Invalid remaining data after end of UDT value");
    }
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;
        }
    }
316306
private void set_fields_from_calendar(Calendar cal,
                                          Precision precision,
                                          boolean setLocalOffset)
    {
        _precision = precision;
        _offset = UNKNOWN_OFFSET;
        boolean dayPrecision = false;
        boolean calendarHasMilliseconds = cal.isSet(Calendar.MILLISECOND);

        switch (this._precision) {
            case FRACTION:
            case SECOND:
                this._second = checkAndCastSecond(cal.get(Calendar.SECOND));
                if (calendarHasMilliseconds) {
                    BigDecimal millis = BigDecimal.valueOf(cal.get(Calendar.MILLISECOND));
                    this._fraction = millis.movePointLeft(3); // convert to fraction
                    checkFraction(precision, this._fraction);
                }
            case MINUTE:
            {
                this._hour   = checkAndCastHour(cal.get(Calendar.HOUR_OF_DAY));
                this._minute = checkAndCastMinute(cal.get(Calendar.MINUTE));

                // If this test is made before calling get(), it will return
                // false even when Calendar.setTimeZone() was called.
                if (setLocalOffset && cal.isSet(Calendar.ZONE_OFFSET))
                {
                    int offset = cal.get(Calendar.ZONE_OFFSET);
                    if (cal.isSet(Calendar.DST_OFFSET)) {
                        offset += cal.get(Calendar.DST_OFFSET);
                    }

                    // convert ms to minutes
                    _offset = offset / (1000*60);
                }
            }
            case DAY:
                dayPrecision = true;
            case MONTH:
                // Calendar months are 0 based, Timestamp months are 1 based
                this._month  = checkAndCastMonth((cal.get(Calendar.MONTH) + 1));
            case YEAR:
                int year;
                if(cal.get(Calendar.ERA) == GregorianCalendar.AD) {
                    year = cal.get(Calendar.YEAR);
                }
                else {
                    year = -cal.get(Calendar.YEAR);
                }

                this._year = checkAndCastYear(year);
        }

        if (dayPrecision)
        {
            this._day = checkAndCastDay(cal.get(Calendar.DAY_OF_MONTH), _year, _month);
        }

        if (_offset != UNKNOWN_OFFSET) {
            // Transform our members from local time to Zulu
            this.apply_offset(_offset);
        }
    }
1022787
public boolean verify(JComponent input) {
        JTextField tf = (JTextField) input;
        try {
            int inputInt = Integer.parseInt(tf.getText());
            return (inputInt >= min && inputInt <= max);
        } catch (NumberFormatException e) {
            return false;
        }
    }
346553
public boolean isSet(_Fields field) {
    if (field == null) {
      throw new IllegalArgumentException();
    }

    switch (field) {
    case QUALIFIERS:
      return isSetQualifiers();
    }
    throw new IllegalStateException();
  }
913038
public boolean validateAllFields() {
        final boolean postalCodeValid;

        final String countrySelected = mCountryAutoCompleteTextView.getSelectedCountryCode();
        if (mPostalCodeEditText.getText().toString().isEmpty() &&
                (mOptionalShippingInfoFields.contains(POSTAL_CODE_FIELD) ||
                        mHiddenShippingInfoFields.contains(POSTAL_CODE_FIELD))) {
            postalCodeValid = true;
        } else if (countrySelected.equals(Locale.US.getCountry())) {
            postalCodeValid = CountryUtils.isUSZipCodeValid(mPostalCodeEditText.getText()
                    .toString().trim());
        } else if (countrySelected.equals(Locale.UK.getCountry())) {
            postalCodeValid = CountryUtils.isUKPostcodeValid(mPostalCodeEditText.getText()
                    .toString().trim());
        } else if (countrySelected.equals(Locale.CANADA.getCountry())) {
            postalCodeValid = CountryUtils.isCanadianPostalCodeValid(mPostalCodeEditText.getText()
                    .toString().trim());
        } else if (CountryUtils.doesCountryUsePostalCode(countrySelected)) {
            postalCodeValid = !mPostalCodeEditText.getText().toString().isEmpty();
        } else {
            postalCodeValid = true;
        }
        mPostalCodeEditText.setShouldShowError(!postalCodeValid);

        final boolean requiredAddressLine1Empty = mAddressEditText.getText().toString().isEmpty() &&
                !mOptionalShippingInfoFields.contains(ADDRESS_LINE_ONE_FIELD) &&
                !mHiddenShippingInfoFields.contains(ADDRESS_LINE_ONE_FIELD);
        mAddressEditText.setShouldShowError(requiredAddressLine1Empty);

        final boolean requiredCityEmpty = mCityEditText.getText().toString().isEmpty() &&
                !mOptionalShippingInfoFields.contains(CITY_FIELD) && !mHiddenShippingInfoFields
                .contains(CITY_FIELD);
        mCityEditText.setShouldShowError(requiredCityEmpty);

        final boolean requiredNameEmpty = mNameEditText.getText().toString().isEmpty();
        mNameEditText.setShouldShowError(requiredNameEmpty);

        final boolean requiredStateEmpty = mStateEditText.getText().toString().isEmpty() &&
                !mOptionalShippingInfoFields.contains(STATE_FIELD) && !mHiddenShippingInfoFields
                .contains(STATE_FIELD);
        mStateEditText.setShouldShowError(requiredStateEmpty);

        final boolean requiredPhoneNumberEmpty =
                mPhoneNumberEditText.getText().toString().isEmpty() &&
                        !mOptionalShippingInfoFields.contains(PHONE_FIELD) &&
                        !mHiddenShippingInfoFields.contains(PHONE_FIELD);
        mPhoneNumberEditText.setShouldShowError(requiredPhoneNumberEmpty);

        return postalCodeValid && !requiredAddressLine1Empty && !requiredCityEmpty &&
                !requiredStateEmpty && !requiredNameEmpty && !requiredPhoneNumberEmpty;
    }
1038023
def validate_field(field, allowed_keys, allowed_types):
    """"""
    for key, value in field.items():
        if key not in allowed_keys:
            raise exceptions.ParametersFieldError(key, "property")
        if key == defs.TYPE:
            if value not in allowed_types:
                raise exceptions.ParametersFieldError(value, key)
        if key == defs.VALUE:
            if not is_valid_field_name(value):
                raise exceptions.ParametersFieldError(value, "field name")
1001682
public static FormValidation validateIntegerInRange(String value, int lower, int upper) {
        try {
            int intValue = Integer.parseInt(value);
            if (intValue < lower) {
                return error(hudson.model.Messages.Hudson_MustBeAtLeast(lower));
            }
            if (intValue > upper) {
                return error(hudson.model.Messages.Hudson_MustBeAtMost(upper));
            }
            return ok();
        } catch (NumberFormatException e) {
            return error(hudson.model.Messages.Hudson_NotANumber());
        }
    }