On Mon, Jul 2, 2012 at 10:42 AM, Hardy Ferentschik <hardy(a)hibernate.org> wrote:
>> 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
as Gunnar is already suggesting this would imo be a major undertaking which is not
suitable for BV 1.1
It's certainly a bigger discussion than just JavaFX; doing this right
might require re-architecting the whole ConstraintValidator/Factory
structure. The service locator concept puts me in mind of all kinds
of things. Do we have a basic idea of how often we are open to
creating a new version of the spec? i.e., for anything we table in
the interest of finishing v1.1, how long must it then wait to be
reconsidered for the next version?
beanvalidation-dev mailing list