MCPcopy Index your code
hub / github.com/castello/spring_basic / validate

Method validate

ch3/UserValidator.java:14–31  ·  view source on GitHub ↗
(Object target, Errors errors)

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls 1

getIdMethod · 0.95

Tested by

no test coverage detected