1 package se.citerus.dddsample.interfaces.tracking;
2
3 import org.springframework.validation.Errors;
4 import org.springframework.validation.ValidationUtils;
5 import org.springframework.validation.Validator;
6
7
8
9
10 public final class TrackCommandValidator implements Validator {
11
12 public boolean supports(final Class clazz) {
13 return TrackCommand.class.isAssignableFrom(clazz);
14 }
15
16 public void validate(final Object object, final Errors errors) {
17 ValidationUtils.rejectIfEmptyOrWhitespace(errors, "trackingId", "error.required", "Required");
18 }
19
20 }
21