Parses the given validation string and tries to map annotations from
properties.

@param validate
String with validation information
@return validation annotations
509670
private String handleValidationAnnotations(String validate) {

		if (validate == null)
			return "";

		if (validate.length() > 15) {
			@SuppressWarnings("unused")
			boolean baa = true;
		}

		// parsing the validate string is simple text replacement
		validate = validate.replaceAll("&&", " ");
		validate = validate.replaceAll("'", "\"");
		for (Map.Entry<String, String> entry : propBase.validationAnnotationDefinitions().entrySet()) {
			String firstChar = entry.getKey().substring(0, 1);
			String keyPattern = "[" + firstChar.toUpperCase() + firstChar.toLowerCase() + "]" + entry.getKey().substring(1);

			validate = validate.replaceAll("@" + keyPattern, "@" + entry.getValue());
		}

		return validate.trim();
	}
1172400
public Map<String, Map<String, Map<String, Map<String, ?>>>> validationConstraints(String type) {
		return getEntity(invokeGet(Utils.formatMessage("_constraints/{0}", type), null), Map.class);
	}
12681
public function validate(...$validate)
    {
        if( $this->validate === [] )
        {
            $this->validate = $validate;
        }
        else
        {
            $this->validate = array_merge($this->validate, $validate);
        }

        return $this;
    }
886266
public static @Nonnull FormValidation aggregate(@Nonnull Collection<FormValidation> validations) {
        if (validations == null || validations.isEmpty()) return FormValidation.ok();

        if (validations.size() == 1) return validations.iterator().next();

        final StringBuilder sb = new StringBuilder("<ul style='list-style-type: none; padding-left: 0; margin: 0'>");
        FormValidation.Kind worst = Kind.OK;
        for (FormValidation validation: validations) {
            sb.append("<li>").append(validation.renderHtml()).append("</li>");

            if (validation.kind.ordinal() > worst.ordinal()) {
                worst = validation.kind;
            }
        }
        sb.append("</ul>");

        return respond(worst, sb.toString());
    }
127060
public void annotateFieldJSR303(JMethod getter, boolean addValidAnnotation) {
		if (isRequired()) {
			getter.annotate(NotNull.class);
		}
		if (StringUtils.hasText(getPattern())) {
			JAnnotationUse annotation = getter.annotate(Pattern.class);
			annotation.param("regexp", getPattern());
		}
		if (getMinLength() != null || getMaxLength() != null) {
			JAnnotationUse annotation = getter.annotate(Size.class);

			if (getMinLength() != null) {
				annotation.param("min", getMinLength());
			}

			if (getMaxLength() != null) {
				annotation.param("max", getMaxLength());
			}
		}
		if (addValidAnnotation) {
			getter.annotate(Valid.class);
		}

		if (minimum != null) {
			JAnnotationUse annotation = getter.annotate(DecimalMin.class);
			annotation.param("value", String.valueOf(minimum));
		}

		if (maximum != null) {
			JAnnotationUse annotation = getter.annotate(DecimalMax.class);
			annotation.param("value", String.valueOf(maximum));
		}
	}
48528
private Set<String> validateURL(ValidationHelper helper, Context context, String url) {
        String pathToCheck = url;
        Set<String> serverVariables = new HashSet<String>();

        while (pathToCheck.contains("{")) {
            if (!pathToCheck.contains("}")) {
                final String message = Tr.formatMessage(tc, "serverInvalidURL", pathToCheck);
                helper.addValidationEvent(new ValidationEvent(ValidationEvent.Severity.ERROR, context.getLocation("url"), message));
                return serverVariables;
            }
            int firstIndex = pathToCheck.indexOf("{");
            int lastIndex = pathToCheck.indexOf("}");

            if (firstIndex > lastIndex) {
                final String message = Tr.formatMessage(tc, "serverInvalidURL", pathToCheck);
                helper.addValidationEvent(new ValidationEvent(ValidationEvent.Severity.ERROR, context.getLocation("url"), message));
                return serverVariables;
            }

            String variable = pathToCheck.substring(firstIndex + 1, lastIndex);

            if (variable.isEmpty() || variable.contains("{") || variable.contains("/")) {
                final String message = Tr.formatMessage(tc, "serverInvalidURL", pathToCheck);
                helper.addValidationEvent(new ValidationEvent(ValidationEvent.Severity.ERROR, context.getLocation("url"), message));
                return serverVariables;
            }

            serverVariables.add(variable);
            pathToCheck = pathToCheck.substring(lastIndex + 1);
        }

        if (pathToCheck.contains("}")) {
            final String message = Tr.formatMessage(tc, "serverInvalidURL", pathToCheck);
            helper.addValidationEvent(new ValidationEvent(ValidationEvent.Severity.ERROR, context.getLocation("url"), message));
            return serverVariables;
        }

        return serverVariables;
    }
322464
private void parseValidators(BeanDefinitionBuilder builder, Element element) {
        ManagedList validators = new ManagedList();
        for (Element validator : DomUtils.getChildElementsByTagName(element, "validator")) {

            if (validator.hasAttribute("ref")) {
                validators.add(new RuntimeBeanReference(validator.getAttribute("ref")));
            } else {
                validators.add(BeanDefinitionBuilder.rootBeanDefinition(validator.getAttribute("class")).getBeanDefinition());
            }
        }

        if (!validators.isEmpty()) {
            builder.addPropertyValue("messageValidators", validators);
        }
    }
131687
@Override
  public String validateInProperty(String unit, String property) {
		assert checkStringParam(unit) : paramError("validate", "unit", "must not be null or empty");
		assert checkStringParam(property) : paramError("validateInProperty", "property", "must not be null or empty");
		try {
			Term term = new ExpressionParser(model).parse(unit);
			Canonical can = new Converter(model, handlers).convert(term);
			String cu = new ExpressionComposer().compose(can, false);
			if (can.getUnits().size() == 1) {
					if (property.equals(can.getUnits().get(0).getBase().getProperty()))
						return null;
					else
						return "unit "+unit+" is of the property type "+can.getUnits().get(0).getBase().getProperty()+" ("+cu+"), not "+property+" as required.";
			}
			// defined special case
			if ("concentration".equals(property) && ("g/L".equals(cu) || "mol/L".equals(cu)))
				return null;
			
			return "unit "+unit+" has the base units "+cu+", and are not from the property "+property+" as required.";
		} catch (Exception e) {
			return e.getMessage();
		}
	}
440225
function (validation) {

            var validationArray = this._formatValidation(validation).split(','),
                oneValidation;

            for (var i = 0; i < validationArray.length; i++) {
                oneValidation = validationArray[i];
                if (/^[a-z]+$/i.test(oneValidation)) {
                    validationArray[i] = oneValidation.toUpperCase();
                }
            }

            return validationArray;
        }
629497
function ModelValidator($interpolate, $parse, $q, formForConfiguration) {
            this.$interpolate_ = $interpolate;
            this.formForConfiguration_ = formForConfiguration;
            this.nestedObjectHelper_ = new formFor.NestedObjectHelper($parse);
            this.promiseUtils_ = new formFor.PromiseUtils($q);
        }
447034
function parseValidatorNames(attrs) {
		var attrValue = attrs.vsAutocompleteValidator,
			validatorNames = (attrValue!=="") ? attrValue.trim().split(',') : [];

		// normalize validator names
		for (var i = 0; i < validatorNames.length; i++) {
			validatorNames[i] = attrs.$normalize(validatorNames[i]);
		}

		return validatorNames;
	}
1116032
public Map<String, Map<String, Map<String, Map<String, ?>>>> getValidationConstraints() {
		if (validationConstraints == null) {
			validationConstraints = new LinkedHashMap<>();
		}
		return validationConstraints;
	}
872057
protected <T> MultiValidatorElement doOn(final T t) {
        if (registry == null) {
            throw new RuntimeValidateException("When annotation-based validation enabled, one must use configure"
                    + "(Registry) method to let FluentValidator know where to search and get validator instances");
        }
        List<AnnotationValidator> anntValidatorsOfAllFields =
                AnnotationValidatorCache.getAnnotationValidator(registry, t);
        if (CollectionUtil.isEmpty(anntValidatorsOfAllFields)) {
            // no field configured with annotation
            return new MultiValidatorElement(Collections.EMPTY_LIST);
        }

        List<ValidatorElement> elementList = CollectionUtil.createArrayList();
        for (final AnnotationValidator anntValidatorOfOneField : anntValidatorsOfAllFields) {
            Object realTarget = ReflectionUtil.invokeMethod(anntValidatorOfOneField.getMethod(), t);

            if (!CollectionUtil.isEmpty(anntValidatorOfOneField.getValidators())) {
                if (!ArrayUtil.hasIntersection(anntValidatorOfOneField.getGroups(), groups)) {
                    // groups have no intersection
                    LOGGER.debug(String.format("Current groups: %s not match %s", Arrays.toString(groups),
                            anntValidatorOfOneField));
                    continue;
                }

                if (!ArrayUtil.isEmpty(excludeGroups)) {
                    if (ArrayUtil.hasIntersection(anntValidatorOfOneField.getGroups(), excludeGroups)) {
                        LOGGER.debug(String.format("Current groups: %s will be ignored because you specify %s",
                                Arrays.toString(
                                        excludeGroups), anntValidatorOfOneField));
                        continue;
                    }
                }

                for (final Validator v : anntValidatorOfOneField.getValidators()) {
                    elementList.add(new ValidatorElement(realTarget, v, new ToStringable() {
                        @Override
                        public String toString() {
                            return String.format("%s#%s@%s", t.getClass().getSimpleName(),
                                    anntValidatorOfOneField.getField().getName(), v);
                        }
                    }));
                }
            }

            // cascade handle
            if (anntValidatorOfOneField.isCascade()) {
                Field field = anntValidatorOfOneField.getField();
                if (Collection.class.isAssignableFrom(field.getType())) {
                    onEach((Collection) realTarget);
                } else if (field.getType().isArray()) {
                    onEach(ArrayUtil.toWrapperIfPrimitive(realTarget));
                } else {
                    on(realTarget);
                }
            }
        }
        MultiValidatorElement m = new MultiValidatorElement(elementList);
        validatorElementList.add(m);
        return m;
    }
101363
protected void validateDate(String field, String min, String max, String errorKey, String errorMessage) {
		// validateDate(field, Date.valueOf(min), Date.valueOf(max), errorKey, errorMessage);  为了兼容 64位 JDK
		try {
			SimpleDateFormat sdf = new SimpleDateFormat(getDatePattern());
			validateDate(field, sdf.parse(min.trim()), sdf.parse(max.trim()), errorKey, errorMessage);
		} catch (Exception e) {
			addError(errorKey, errorMessage);
		}
	}
1120944
@Override
    public boolean validate(Field f, Object validationObject)
    {
        boolean checkvalidation = true;

        for (Annotation annotation : f.getDeclaredAnnotations())
        {

            AttributeConstraintType eruleType = getERuleType(annotation.annotationType().getSimpleName());

            if (eruleType != null)
            {
                Object fieldValue = PropertyAccessorHelper.getObject(validationObject, f);

                switch (eruleType)
                {

                case ASSERT_FALSE:
                    checkvalidation = validateFalse(fieldValue, annotation);
                    break;
                case ASSERT_TRUE:
                    checkvalidation = validateTrue(fieldValue, annotation);
                    break;
                case DECIMAL_MAX:
                    checkvalidation = validateMaxDecimal(fieldValue, annotation);
                    break;
                case DECIMAL_MIN:
                    checkvalidation = validateMinDecimal(fieldValue, annotation);
                    break;
                case DIGITS:
                    checkvalidation = validateDigits(fieldValue, annotation);
                    break;
                case FUTURE:
                    checkvalidation = validateFuture(fieldValue, annotation);
                    break;
                case MAX:
                    checkvalidation = validateMaxValue(fieldValue, annotation);
                    break;

                case MIN:
                    checkvalidation = validateMinValue(fieldValue, annotation);
                    break;
                case NOT_NULL:
                    checkvalidation = validateNotNull(fieldValue, annotation);
                    break;
                case NULL:
                    checkvalidation = validateNull(fieldValue, annotation);
                    break;
                case PAST:
                    checkvalidation = validatePast(fieldValue, annotation);
                    break;
                case PATTERN:
                    checkvalidation = validatePattern(fieldValue, annotation);
                    break;
                case SIZE:
                    checkvalidation = validateSize(fieldValue, annotation);
                    break;

                }
            }
        }

        return checkvalidation;
    }
332865
public static Long getLong(boolean validate, String key) {
		return Long.valueOf(getString(validate, key));
	}
731452
public static Map<String, String> parseProperties(String s) {
		Map<String, String> properties = new HashMap<String, String>();
		if (!StringUtils.isEmpty(s)) {
			Matcher matcher = PROPERTIES_PATTERN.matcher(s);
			int start = 0;
			while (matcher.find()) {
				addKeyValuePairAsProperty(s.substring(start, matcher.start()), properties);
				start = matcher.start() + 1;
			}
			addKeyValuePairAsProperty(s.substring(start), properties);
		}
		return properties;
	}