On 30 juin 2012, at 19:53, Gunnar Morling wrote:
2012/6/29 Emmanuel Bernard <emmanuel(a)hibernate.org>:
> On 29 juin 2012, at 18:14, Gunnar Morling <gunnar(a)hibernate.org> wrote:
>>> Gunnar could you lead the interaction with the JavaFX folks?
>> Yepp, I'll see what I can do :)
>> IMO one challenge here is that JavaFX has its own property pattern
>> ("private IntegerProperty foo;" instead of "private int
>> Putting constraint annotations to such a property won't help as of
>> today (since there is no ConstraintValidator<Size, IntegerProperty>),
>> but I think there are solutions for this.
> It might make sense for us to add support of JavaFX types in the spec.
> Implementations could use some lazy "binding" in case JavaFX is not there.
> Are these types stable and few or do they change every other morning?
I guess things like IntegerProperty should be rather stable, but
probably users can also create custom property types.
Personally, I find the option of adding support for types of specific
APIs/frameworks to BV not really appealing. Maybe another API than
JavaFX appears tomorrow?
I could imagine to make BV extensible in that respect, e.g. by
providing an SPI for hooking in some sort of adapter which is used by
BV to retrieve values from given models. JavaFX then could provide an
implementation of this SPI based on its property model. BV would not
use reflection to operate on fields and methods and so on but rather
use the SPI to walk over the type hierarchy (the default
implementation of course would be the behavior as of today).
We did explore something around service locators to automatically wire ConstraintValidator
implementations to a constraint.
Maybe it is time to bring it back up.
Another implementation could be used to place and validate constraints
on JSON/map-like structures (e.g. when working with MongoDB etc.);
Constraints would have to be declared via an API/XML but not
annotations in that case.
I have a hard time to picture that. Do you have something specific in mind? To me linking
BV constraints with the outside world
(DB, html etc) should be done like we did for JPA and client side validation, ie by using
the metadata API.