MCPcopy Create free account
hub / github.com/castello/spring_basic / validate

Method validate

ch2/UserValidator.java:15–32  ·  view source on GitHub ↗
(Object target, Errors errors)

Source from the content-addressed store, hash-verified

13 }
14
15 @Override
16 public void validate(Object target, Errors errors) {
17 System.out.println("LocalValidator.validate() is called");
18
19 User user = (User)target;
20
21 String id = user.getId();
22
23 // if(id==null || "".equals(id.trim())) {
24 // errors.rejectValue("id", "required");
25 // }
26 ValidationUtils.rejectIfEmptyOrWhitespace(errors, "id", "required");
27 ValidationUtils.rejectIfEmptyOrWhitespace(errors, "pwd", "required");
28
29 if(id==null || id.length() < 5 || id.length() > 12) {
30 errors.rejectValue("id", "invalidLength");
31 }
32 }
33 }
34

Callers

nothing calls this directly

Calls 1

getIdMethod · 0.95

Tested by

no test coverage detected