[bv-dev] Dependency between constraints and validators
Emmanuel Bernard
emmanuel at hibernate.org
Tue Oct 25 09:33:44 EDT 2011
On 24 oct. 2011, at 22:08, Gunnar Morling wrote:
>>
>> - we would need to list all binding via a programmatic API (that solution does break compile time checking BTW)
>
> Why would that break compile-time type-safety?
Imagine the following code
void main(args[] args) {
ValidatorFactory factory = Validation
.byDefaultProvider()
.configure()
.addBinding(NotNull.class, NumberNotNullValidator.class)
.createValidatorFactory();
public static class Address {
@NotNull String getStreet() { ... };
}
}
How would an annotation processor know that the factory is configured to bind NotNull with NumberNotNullValidator and thus that Address.getStreet cannot be validated?
More information about the beanvalidation-dev
mailing list