View Javadoc

1   package org.springframework.samples.petclinic.validation;
2   
3   import org.springframework.samples.petclinic.Visit;
4   import org.springframework.util.StringUtils;
5   import org.springframework.validation.Errors;
6   
7   /**
8    * <code>Validator</code> for <code>Visit</code> forms.
9    *
10   * @author Ken Krebs
11   * @author Juergen Hoeller
12   */
13  public class VisitValidator {
14  
15  	public void validate(Visit visit, Errors errors) {
16  		if (!StringUtils.hasLength(visit.getDescription())) {
17  			errors.rejectValue("description", "required", "required");
18  		}
19  	}
20  
21  }