public boolean supports(Class clazz) {
return clazz.equals(BillingInfoForm.class);
}
public void validate(Object obj, Errors errors) {
BillingInfoForm billingInfoForm = (BillingInfoForm) obj;
ValidationUtils.rejectIfEmptyOrWhitespace(errors, "address.firstName", "firstName.required");
ValidationUtils.rejectIfEmptyOrWhitespace(errors, "address.lastName", "lastName.required");
ValidationUtils.rejectIfEmptyOrWhitespace(errors, "address.addressLine1", "addressLine1.required");
ValidationUtils.rejectIfEmptyOrWhitespace(errors, "address.city", "city.required");
ValidationUtils.rejectIfEmptyOrWhitespace(errors, "address.postalCode", "postalCode.required");
if (billingInfoForm.getAddress().getCountry() == null) {
errors.rejectValue("address.country", "country.required", null, null);
}
}