[bv-dev] Bean Validation and JavaFX

Emmanuel Bernard emmanuel at hibernate.org
Fri Jun 29 13:23:22 EDT 2012



On 29 juin 2012, at 18:14, Gunnar Morling <gunnar at hibernate.org> wrote:

> Hi,
> 
>> 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 foo;").
> 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?

> 
> Another problem I see with GUI validation is that one typically wants
> to validate form values before putting them into the model. This works
> fine for property-level constraints (using Validator#validateValue()),
> but we have nothing to offer for class-level constraints here.

That would mean some small duplication but the form itself is an object right? We could put the (class level) constraint declarations on it. 


> 
> In case anyone has some ideas or any other input on that subject,
> please let me know.
> 
> --Gunnar
> 
> 
> 2012/6/28 Emmanuel Bernard <emmanuel at hibernate.org>:
>> Interesting, it's good you catch that one.
>> 
>> I have the gut feeling that we can get it to work perfectly with JavaFX including even when there is no binding between the form and the domain model. After all, the form itself can host the validation annotations. and with method validations, we have even more expressivity.
>> 
>> Gunnar could you lead the interaction with the JavaFX folks? Here is what I'd propose:
>> 
>> - invite the guy who prototyped the JavaFX validation tool to join this mailing list
>> - keep an eye on the JavaFX mailing list to see where theya re heading
>> - show them with some explanation how we have integrated Bean Validation and JAX-RS. I it likely that it's going to be quite similar integration wise.
>> - I'd love to get the reason why he things validation's API are too complex. In any case, the FX user probably will never see them as like for JSF, the call will be done by the FX lib during the right lifecycle events
>> 
>> Emmanuel
>> 
>> On 27 juin 2012, at 17:35, Gunnar Morling wrote:
>> 
>>> Hi Emmanuel, hi all,
>>> 
>>> a post in the BV feedback forum [1] just made me aware of a discussion
>>> around form validation on the JavaFX development list [2].
>>> 
>>> The discussion is about adding some means of validation to JavaFX,
>>> with one option being to use BV for that purpose. Naturally, that's an
>>> option I'm personally in favor of :) Thus I've added some thoughts to
>>> the discussion [3], a) recommending to consider BV for that purpose
>>> and b) suggesting to approach this EG to discuss any questions around
>>> BV and its possibilities.
>>> 
>>> As one goal of BV is to provide a validation mechanism for all kinds
>>> of tiers and layers, it would be great to see it used in client
>>> technologies such as JavaFX.
>>> 
>>> --Gunnar
>>> 
>>> [1] https://forum.hibernate.org/viewtopic.php?f=26&t=1015972
>>> [2] http://mail.openjdk.java.net/pipermail/openjfx-dev/2012-June/002311.html
>>> [3] http://mail.openjdk.java.net/pipermail/openjfx-dev/2012-June/002647.html
>> 



More information about the beanvalidation-dev mailing list