mirror of
https://github.com/spring-projects/spring-petclinic.git
synced 2025-07-18 05:45:50 +00:00
Update PetValidator.java
Added detailed comments to validate method
This commit is contained in:
parent
91be2b2c73
commit
547d1e809d
1 changed files with 8 additions and 0 deletions
|
@ -24,9 +24,17 @@ import org.springframework.validation.Errors;
|
||||||
*
|
*
|
||||||
* @author Ken Krebs
|
* @author Ken Krebs
|
||||||
* @author Juergen Hoeller
|
* @author Juergen Hoeller
|
||||||
|
* @author Amit Shejekan
|
||||||
*/
|
*/
|
||||||
public class PetValidator {
|
public class PetValidator {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Validator to validate new Pet information for correctness and completeness.
|
||||||
|
* Error object is set with error messages in case of any validation failures.
|
||||||
|
*
|
||||||
|
* @param Pet - Pet object containing new Pet information such as name, owner
|
||||||
|
* @return - The method sets the error object and does not return anything
|
||||||
|
*/
|
||||||
public void validate(Pet pet, Errors errors) {
|
public void validate(Pet pet, Errors errors) {
|
||||||
String name = pet.getName();
|
String name = pet.getName();
|
||||||
if (!StringUtils.hasLength(name)) {
|
if (!StringUtils.hasLength(name)) {
|
||||||
|
|
Loading…
Reference in a new issue