Hi,
We are using Hibernate Validator to augment the UI code that constructs a form (using Vaadin as the UI framework). We are scanning our beans looking for validation annotations, then marking the field (constructed by Vaadin) with a special "do validation this way" method.
we have something like this:
Code:
annotation = attribute.getAnnotation(Range.class);
if (annotation != null) {
final Range rangeAnnotation = (Range)annotation;
field.addValidator(new RangeValidator(getI18nValidationMessage(rangeAnnotation.message()), rangeAnnotation));
}
Then, in our RangeValidator, we have something that *should* be like this:
Code:
public RangeValidator(final String message, final Range rangeAnnotation) {
super(message);
rangeValidator = new org.hibernate.validator.constraints.impl.RangeValidator();
rangeValidator.initialize(rangeAnnotation);
}
I say *should* because org.hibernate.validator.constraints.impl.RangeValidator does not exist, whereas another class that we *are* using, org.hibernate.validator.constraints.impl.EmailValidator does exist.
All this is okay (sort of :-)), I can easy write my own RangeValidator like the Reference documentation says, but I have a few questions:
1. Should org.hibernate.validator.constraints.impl.RangeValidator not be there? (it's in Validator 3.1.0.GA)
2. If it has been removed, what replaces it? Would @Size offer the equivalent functionality?
Thank you.
-=bootlaces=-