[bv-dev] Bean Validation and JavaFX
Hardy Ferentschik
hardy at hibernate.org
Mon Jul 2 11:42:07 EDT 2012
>> We did explore something around service locators to automatically wire ConstraintValidator implementations to a constraint.
>> Maybe it is time to bring it back up.
>
> Do you have some more details on that?
Bean Validation already has a mechanism for overriding/adding constraint definitions, namely the XML deployment descriptor.
All JavaFX would have to do is to implement the ConstraintValidators for the different constraints and bootstrap Bean Validation
accordingly. Of course this could be made easier if there would be also a programmatic way to add constraint validators. Or we try to
go the service locator approach and to automate the discovery.
>> As of today, the annotations would be of no effect, as there are not
>> validators such as SizeValidator<Size, StringProperty>. But using the
>> SPI, one could hook in an adapter which creates a representation of
>> the Employee type in the abstract model (with e.g. the "lastName"
>> property being of type String), which would allow the BV runtime to
>> operate on it.
>>
>> That said, I'm aware of that this would probably be a large addition,
>> and I'm not sure whether it would be doable at all.
>
> Yes I am not convinced there us such demand for such feature. And that would definitively be a big undertaking.
> What do others think?
I agree. Bean Validation is really centered around Java Beans and classes in general.
There is not only the problem of "discovering" the properties to validate, but also how to
integrate constraint inheritance, group sequences, etc.
Maybe if one thinks about all this very very carefully there is a way to put it all together, but
as Gunnar is already suggesting this would imo be a major undertaking which is not suitable for BV 1.1
--Hardy
More information about the beanvalidation-dev
mailing list