Package org.springframework.validation

Examples of org.springframework.validation.Validator.validate()


     */
    protected void applyCustomValidator(BeanValidationConfiguration configuration, Object obj, Errors errors) {
        Validator validator = configuration.getCustomValidator();
        if (validator != null) {
            if (validator.supports(obj.getClass())) {
                validator.validate(obj, errors);
            }
        }
    }

}
View Full Code Here


     */
    public void validate(Object obj, Errors errors) {
        for (Iterator i = validators.iterator(); i.hasNext();) {
            Validator validator = (Validator) i.next();
            if (validator.supports(obj.getClass())) {
                validator.validate(obj, errors);
            }
        }
    }

    /**
 
View Full Code Here

            logger.warn("Validation hints provided but validator not an instance of SmartValidator: ["
                + springValidator.getClass().getName() + "]");
          }
        }
        else {
          springValidator.validate(model, errors);
        }
      } else {
        if (logger.isDebugEnabled()) {
          logger.debug("Spring Validator '" + ClassUtils.getShortName(validator.getClass())
              + "' doesn't support model class " + model.getClass());
View Full Code Here

   
    AnnotationConfigApplicationContext cxt = new AnnotationConfigApplicationContext(MyConfig.class);
    ConfigurableWebBindingInitializer bean = cxt.getBean(ConfigurableWebBindingInitializer.class);
    Validator validator = bean.getValidator();
    assertNotNull(validator);
    validator.validate(new Object(), new BeanPropertyBindingResult(new Object(), ""));
  }
 
}
View Full Code Here

        for(Entry<String, HasValidator> entry : getBeansOfType(HasValidator.class).entrySet()) {
            String name = entry.getKey();
            HasValidator hv = entry.getValue();
            Validator v = hv.getValidator();
            Errors errors = new BeanPropertyBindingResult(hv,name);
            v.validate(hv, errors);
            if(errors.hasErrors()) {
                allErrors.put(name,errors);
            }
        }
        for(String name : allErrors.keySet()) {
View Full Code Here

                Errors errors = new BindException(currentDomainObject,
                        clazz.getName());
                Validator v = findValidator(clazz);

                // Perform validation
                v.validate(currentDomainObject, errors);

                // Handle validation outcome
                if (errors.getErrorCount() == 0) {
                    if (logger.isDebugEnabled()) {
                        logger.debug("Validated '" + clazz + "' successfully using '"
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.