If the request entity is annotated with {@link Validated} then run
validations in the specified constraint group else validate with the
{@link Default} group
331232
private Class<?>[] getGroup(Invocable invocable) {
        final List<Class<?>[]> groups = new ArrayList<>();
        for (Parameter parameter : invocable.getParameters()) {
            if (parameter.isAnnotationPresent(Validated.class)) {
                groups.add(parameter.getAnnotation(Validated.class).value());
            }
        }

        switch (groups.size()) {
            // No parameters were annotated with Validated, so validate under the default group
            case 0: return new Class<?>[] {Default.class};

            // A single parameter was annotated with Validated, so use their group
            case 1: return groups.get(0);

            // Multiple parameters were annotated with Validated, so we must check if
            // all groups are equal to each other, if not, throw an exception because
            // the validator is unable to handle parameters validated under different
            // groups. If the parameters have the same group, we can grab the first
            // group.
            default:
                for (int i = 0; i < groups.size(); i++) {
                    for (int j = i; j < groups.size(); j++) {
                        if (!Arrays.deepEquals(groups.get(i), groups.get(j))) {
                            throw new WebApplicationException("Parameters must have the same validation groups in " +
                                invocable.getHandlingMethod().getName(), 500);
                        }
                    }
                }
                return groups.get(0);
        }
    }
797790
protected void validate(final CmsEntity entity) {

        if (!m_validating) {
            m_validating = true;
            m_contentService.validateEntity(entity, new AsyncCallback<CmsValidationResult>() {

                public void onFailure(Throwable caught) {

                    // can be ignored
                }

                public void onSuccess(CmsValidationResult result) {

                    displayValidation(entity.getId(), result);
                }
            });
        }
    }
597223
private static void validateEntity(Entity entity) throws DbRuntimeException {
		if (null == entity) {
			throw new DbRuntimeException("Entity is null !");
		}
		if (StrUtil.isBlank(entity.getTableName())) {
			throw new DbRuntimeException("Entity`s table name is null !");
		}
		if (entity.isEmpty()) {
			throw new DbRuntimeException("No filed and value in this entity !");
		}
	}
1141413
private void validateBean(Object bean) throws PropertyException
    {
        if (getValidatorFactory() != null) {
            Validator validator = getValidatorFactory().getValidator();
            Set<ConstraintViolation<Object>> constraintViolations = validator.validate(bean);
            if (!constraintViolations.isEmpty()) {
                throw new PropertyException(
                    "Failed to validate bean: [" + constraintViolations.iterator().next().getMessage() + "]");
            }
        }
    }
954308
private void validate() {
        if (isValid != null) {
            return;
        }

        ParsingValidator v =
            new ParsingValidator(useSchema ? Languages.W3C_XML_SCHEMA_NS_URI
                                 : Languages.XML_DTD_NS_URI);
        List<Source> schemaSourceList = new ArrayList<Source>();
        if (systemId != null) {
            schemaSourceList.add(new StreamSource(systemId));
        }
        addSchemaSources(schemaSource, schemaSourceList);
        v.setSchemaSources(schemaSourceList.toArray(new Source[0]));

        try {
            ValidationResult r =
                v.validateInstance(new SAXSource(validationInputSource));
            isValid = r.isValid() ? Boolean.TRUE : Boolean.FALSE;
            for (ValidationProblem p : r.getProblems()) {
                validationProblem(p);
            }
        } catch (org.xmlunit.ConfigurationException e) {
            throw new ConfigurationException(e.getCause());
        } catch (org.xmlunit.XMLUnitException e) {
            throw new XMLUnitRuntimeException(e.getMessage(), e.getCause());
        }

        if (usingDoctypeReader && isValid == Boolean.FALSE) {
            try {
                messages.append("\nContent was: ")
                    .append(getOriginalContent(validationInputSource));
            } catch (IOException e) {
                // silent but deadly?
            }
        }
    }
15351
@Override
  public final boolean isValid(final Object pvalue, final ConstraintValidatorContext pcontext) {
    if (pvalue == null) {
      return true;
    }
    try {
      final String field1Value =
          getDomainOf(BeanPropertyReaderUtil.getNullSaveStringProperty(pvalue, field1Name));
      final String field2Value =
          getDomainOf(BeanPropertyReaderUtil.getNullSaveStringProperty(pvalue, field2Name));
      if (!StringUtils.equals(field1Value, field2Value)) {
        switchContext(pcontext);
        return false;
      }
      return true;
    } catch (final Exception ignore) {
      switchContext(pcontext);
      return false;
    }
  }
578150
protected void validate(final boolean isDomain) throws MojoDeploymentException {
        final boolean hasServerGroups = hasServerGroups();
        if (isDomain) {
            if (!hasServerGroups) {
                throw new MojoDeploymentException(
                        "Server is running in domain mode, but no server groups have been defined.");
            }
        } else if (hasServerGroups) {
            throw new MojoDeploymentException("Server is running in standalone mode, but server groups have been defined.");
        }
    }
1182274
public void validate(EntityType entityType) {
    validateEntityId(entityType);
    validateEntityLabel(entityType);
    validatePackage(entityType);
    validateExtends(entityType);
    validateOwnAttributes(entityType);

    Map<String, Attribute> ownAllAttrMap =
        stream(entityType.getOwnAllAttributes())
            .collect(toLinkedMap(Attribute::getIdentifier, Function.identity()));

    validateOwnIdAttribute(entityType, ownAllAttrMap);
    validateOwnLabelAttribute(entityType, ownAllAttrMap);
    validateOwnLookupAttributes(entityType, ownAllAttrMap);
    validateLabelAttribute(entityType);
    validateBackend(entityType);
  }
666898
public function validate($value, Constraint $constraint)
    {
        /** @var EntityExists $constraint */
        if ($constraint->validate($value)) {
            $this->context->addViolation(
                $constraint->message,
                [
                    '{{ type }}' => $constraint->entityClass,
                    '{{ value }}' => $value,
                ]
            );
        }
    }
470374
protected void validate( QueryContext context,
                             QueryCommand query,
                             Map<SelectorName, Table> usedSelectors ) {
        // // Resolve everything ...
        // Visitors.visitAll(query, new Validator(context, usedSelectors));
        // Resolve everything (except subqueries) ...
        Validator validator = new Validator(context, usedSelectors);
        query.accept(new WalkAllVisitor(validator) {
            @Override
            protected void enqueue( Visitable objectToBeVisited ) {
                if (objectToBeVisited instanceof Subquery) return;
                super.enqueue(objectToBeVisited);
            }
        });
    }
262872
public static void validate(HppRequest hppRequest) {
		Set<ConstraintViolation<HppRequest>> constraintViolations = validator.validate(hppRequest);

		if (constraintViolations.size() > 0) {
			List<String> validationMessages = new ArrayList<String>();
			Iterator<ConstraintViolation<HppRequest>> i = constraintViolations.iterator();

			while (i.hasNext()) {
				ConstraintViolation<HppRequest> constraitViolation = i.next();
				validationMessages.add(constraitViolation.getMessage());
			}

			LOGGER.info("HppRequest failed validation with the following errors {}", validationMessages);
			throw new RealexValidationException("HppRequest failed validation", validationMessages);
		}
	}
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;
    }
91787
public function validate($group, Constraint $constraint)
    {
        $check = $this->container->get('admin.configuration.configgroup_manager')->getRepository()->findOneBySectionAndGroupName($group->getConfigSection()->getName(), $group->getName());
        if ( $check && $check->getId() != $group->getId()) {
            $message = $this->container->get('translator')->trans(
                $constraint->message,
                array(
                    '%group%' => $group->getName(),
                    '%section%' => $group->getConfigSection()->getName()
                ),
                'VinceTAdminConfigurationBundle'
            );
            $this->context->addViolation($message);
        }
    }
578397
def _validate_annotation(self, annotation):
        ''''''
        required_keys = set(self._required_keys)
        keys = set(key for key, val in annotation.items() if val)
        missing_keys = required_keys.difference(keys)
        if missing_keys:
            error = 'Annotation missing required fields: {0}'.format(
                missing_keys)
            raise AnnotationError(error)
1173885
public function validate($entity, Constraint $constraint): void
    {
        /** @var HasEnabledEntity $constraint */
        Assert::isInstanceOf($constraint, HasEnabledEntity::class);

        $enabled = $this->accessor->getValue($entity, $constraint->enabledPath);

        if ($enabled === true) {
            return;
        }

        $objectManager = $this->getProperObjectManager($constraint->objectManager, $entity);

        $this->ensureEntityHasProvidedEnabledField($objectManager, $entity, $constraint->enabledPath);

        $criteria = [$constraint->enabledPath => true];

        $repository = $objectManager->getRepository(get_class($entity));
        $results = $repository->{$constraint->repositoryMethod}($criteria);

        /* If the result is a MongoCursor, it must be advanced to the first
         * element. Rewinding should have no ill effect if $result is another
         * iterator implementation.
         */
        if ($results instanceof \Iterator) {
            $results->rewind();
        } elseif (is_array($results)) {
            reset($results);
        }

        if ($this->isLastEnabledEntity($results, $entity)) {
            $errorPath = null !== $constraint->errorPath ? $constraint->errorPath : $constraint->enabledPath;

            $this->context->buildViolation($constraint->message)->atPath($errorPath)->addViolation();
        }
    }
1285728
public void validate(String path, Schema schema, Object value, List<ValidationResult> results) {
		if (_rules == null)
			return;

		for (IValidationRule rule : _rules)
			rule.validate(path, schema, value, results);
	}
719695
@Override
    public void validate() throws OpsGenieClientValidationException {
        super.validate();
        if (username == null && id == null)
            throw OpsGenieClientValidationException.missingMultipleMandatoryProperty(OpsGenieClientConstants.API.USERNAME, OpsGenieClientConstants.API.ID);
    }