将需要额外验证的验证器封装为{@link ValidatorChain}

@param fluentValid 参数上的注解装饰

@return 验证器链
488671
private ValidatorChain getAddOnValidatorChain(FluentValid fluentValid) {
        ValidatorChain chain = new ValidatorChain();
        chain.setValidators(getAddOnValidators(fluentValid));
        return chain;
    }
369683
static String getIdAttributeValidationExpression() {
    String isIdIsTrue = "$('" + IS_ID_ATTRIBUTE + "').eq(true)";
    String isIdIsFalseOrNull =
        "$('" + IS_ID_ATTRIBUTE + "').eq(false).or($('" + IS_ID_ATTRIBUTE + "').isNull())";

    // Use the valid ID attribute types to constuct the validation expression
    List<String> typeExpressions =
        getValidIdAttributeTypes()
            .stream()
            .map(attributeType -> "$('" + TYPE + "').eq('" + getValueString(attributeType) + "')")
            .collect(Collectors.toList());

    boolean first = true;
    StringBuilder typeIsNullOrStringOrIntOrLong = new StringBuilder();
    for (String expression : typeExpressions) {
      if (first) {
        typeIsNullOrStringOrIntOrLong.append(expression);
        first = false;
        continue;
      }
      typeIsNullOrStringOrIntOrLong.append(".or(").append(expression).append(")");
    }
    typeIsNullOrStringOrIntOrLong.append(".or($('" + TYPE + "').isNull())");

    String nullableIsFalse = "$('" + IS_NULLABLE + "').eq(false)";

    return isIdIsFalseOrNull
        + ".or("
        + isIdIsTrue
        + ".and("
        + typeIsNullOrStringOrIntOrLong
        + ").and("
        + nullableIsFalse
        + ")).value()";
  }
280768
public static Validator validTrustManagerFactory() {
    return (s, o) -> {
      if (!(o instanceof String)) {
        throw new ConfigException(s, o, "Must be a string.");
      }

      String keyStoreType = o.toString();
      try {
        TrustManagerFactory.getInstance(keyStoreType);
      } catch (NoSuchAlgorithmException e) {
        ConfigException exception = new ConfigException(s, o, "Invalid Algorithm");
        exception.initCause(e);
        throw exception;
      }
    };
  }
971930
public void setChaincodeValidationPlugin(String chaincodeValidationPlugin) throws InvalidArgumentException {
        if (Utils.isNullOrEmpty(chaincodeValidationPlugin)) {
            throw new InvalidArgumentException("The getChaincodeValidationPlugin parameter can not be null or empty.");
        }
        this.chaincodeValidationPlugin = chaincodeValidationPlugin;
    }
544540
public <T> FluentValidator onEach(Collection<T> t) {
        if (CollectionUtil.isEmpty(t)) {
            lastAddCount = 0;
            return this;
        }

        MultiValidatorElement multiValidatorElement = null;
        for (T element : t) {
            multiValidatorElement = doOn(element);
            lastAddCount += multiValidatorElement.size();
        }
        LOGGER.debug(
                String.format("Total %d of %s will be performed", t.size(), multiValidatorElement));
        return this;
    }
13178
@Override
	public boolean validate(Graph<K, VV, EV> graph) throws Exception {
		DataSet<Tuple1<K>> edgeIds = graph.getEdges()
				.flatMap(new MapEdgeIds<>()).distinct();
		DataSet<K> invalidIds = graph.getVertices().coGroup(edgeIds).where(0)
				.equalTo(0).with(new GroupInvalidIds<>()).first(1);

		return invalidIds.map(new KToTupleMap<>()).count() == 0;
	}
30373
private Validator createDefaultValidator() {
        final ValidatorFactory validatorFactory = Validation.buildDefaultValidatorFactory();
        final Validator validator = validatorFactory.usingContext()
                .getValidator();
        
        return validator;
    }
1149525
@Override
    public ValidationResult validate(@Nullable final Object value) {
        if (value instanceof ObjectId) {
            return new ValidationResult.ValidationPassed();
        } else {
            return new ValidationResult.ValidationFailed(String.valueOf(value) + " is not a valid ObjectId!");
        }
    }
1253231
private function parseChain($chain = []): void
    {
        if (!\is_array($chain)) {
            throw new InvalidArgumentException('Validators chain must be an array');
        }
        foreach ($chain as $k => $v) {
            if ($v instanceof AbstractSpecific) {
                // value is an instance of AbstractSpecific
                $reflection = new \ReflectionClass($v);
                $name = \str_replace($reflection->getNamespaceName().'\\', '', $reflection->getName());
                $this->chain[$name] = $v;
            } elseif (\is_string($k) && \is_array($v)) {
                // key is a string (validator name) and value is an array (validator options)
                $className = '\\MS\\LightFramework\\Validator\\Specific\\'.$k;
                if (!\class_exists($className)) {
                    throw new InvalidArgumentException('Validator "'.$k.'" not found');
                }
                $this->chain[$k] = new $className($v);
            } elseif (\is_numeric($k) && \is_array($v)) {
                // key is a numeric and value is an array (validator name => validator options)
                $this->parseChain($v);
            } else {
                // incorrect chain format
                $exMsg = 'Validator chain element must be either instance of AbstractValidator ';
                $exMsg .= 'or array("validatorName" => array(options))';
                throw new InvalidArgumentException($exMsg);
            }
        }
    }
437106
@Override
    public T validate(T wert) {
        if (!isValid(wert)) {
            throw new InvalidLengthException(Objects.toString(wert), min, max);
        }
        return wert;
    }
648328
private Iterable<String> validate(final String input) {
        if (optional && input.isEmpty()) return Lists.newArrayList();
        return FluentIterable
                .from(validators)
                .filter(new Predicate<Validator>() {
                    @Override
                    public boolean apply(Validator validator) {
                        try {
                            return !validator.valid(input);
                        } catch (Exception e) {
                            return true;
                        }
                    }
                })
                .transform(new Function<Validator, String>() {
                    @Override
                    public String apply(Validator input) {
                        return input.message();
                    }
                });
    }
901248
@Singleton
    @Requires(classes = HibernateValidator.class)
    ValidatorFactory validatorFactory(Optional<Environment> environment) {
        Configuration validatorConfiguration = Validation.byDefaultProvider()
            .configure();

        messageInterpolator.ifPresent(validatorConfiguration::messageInterpolator);
        traversableResolver.ifPresent(validatorConfiguration::traversableResolver);
        constraintValidatorFactory.ifPresent(validatorConfiguration::constraintValidatorFactory);
        parameterNameProvider.ifPresent(validatorConfiguration::parameterNameProvider);

        if (ignoreXmlConfiguration) {
            validatorConfiguration.ignoreXmlConfiguration();
        }
        environment.ifPresent(env -> {
            Optional<Properties> config = env.getProperty("hibernate.validator", Properties.class);
            config.ifPresent(properties -> {
                for (Map.Entry<Object, Object> entry : properties.entrySet()) {
                    Object value = entry.getValue();
                    if (value != null) {
                        validatorConfiguration.addProperty(
                            "hibernate.validator." + entry.getKey(),
                            value.toString()
                        );
                    }
                }
            });
        });
        return validatorConfiguration.buildValidatorFactory();
    }
348896
@Override
    public boolean validateEntity(Class clazz)
    {
        EntityValidatorAgainstCounterColumn entityValidatorAgainstSchema = new EntityValidatorAgainstCounterColumn();
        return entityValidatorAgainstSchema.validateEntity(clazz);
    }
492794
public FluentValidator putAttribute2Context(String key, Object value) {
        if (context == null) {
            context = new ValidatorContext();
        }
        context.setAttribute(key, value);
        return this;
    }
883629
public T validationCallback(ValidationCallback callback) {
        if (callback instanceof ApplicationContextAware) {
            ((ApplicationContextAware) callback).setApplicationContext(applicationContext);
        }

        getAction().setValidationCallback(callback);
        return self;
    }
554738
public CmsAliasEditValidationReply validateAliases(CmsAliasEditValidationRequest validationRequest) {

        List<CmsAliasTableRow> editedData = validationRequest.getEditedData();
        CmsAliasTableRow newEntry = validationRequest.getNewEntry();
        if (newEntry != null) {
            newEntry.setKey((new CmsUUID()).toString());
            editedData.add(newEntry);

        }
        CmsObject cms = m_cms;
        Locale locale = OpenCms.getWorkplaceManager().getWorkplaceLocale(cms);
        for (CmsAliasTableRow row : editedData) {
            row.clearErrors();
            validateSingleAliasRow(cms, row);
        }
        Set<String> foundAliasPaths = new HashSet<String>();
        Set<String> duplicateAliasPaths = new HashSet<String>();
        for (CmsAliasTableRow row : editedData) {
            String aliasPath = row.getAliasPath();
            if (foundAliasPaths.contains(aliasPath)) {
                duplicateAliasPaths.add(aliasPath);
            }
            foundAliasPaths.add(aliasPath);
        }
        for (CmsAliasTableRow row : editedData) {
            if (duplicateAliasPaths.contains(row.getAliasPath())) {
                if (row.getPathError() == null) {
                    row.setAliasError(messageDuplicateAliasPath(locale));
                    m_hasErrors = true;
                }
            }
        }
        CmsAliasEditValidationReply result = new CmsAliasEditValidationReply();
        List<CmsAliasTableRow> changedRows = new ArrayList<CmsAliasTableRow>();
        for (CmsAliasTableRow row : editedData) {
            if (row.isChanged()) {
                changedRows.add(row);
            }
        }
        if (newEntry != null) {
            changedRows.remove(newEntry);
        }
        result.setChangedRows(changedRows);
        result.setValidatedNewEntry(newEntry);
        return result;
    }
1010507
public ValidatorType<TldTaglibType<T>> getOrCreateValidator()
   {
      Node node = childNode.getOrCreate("validator");
      ValidatorType<TldTaglibType<T>> validator = new ValidatorTypeImpl<TldTaglibType<T>>(this, "validator", childNode, node);
      return validator;
   }