JavaFX Form Validation

Will Hoover java.whoover at
Tue Jun 12 11:20:57 PDT 2012

I agree. My proposal includes both. Option 1 would cause validators to get
their cues from annotations and is pluggable from the viewpoint that they
are using a generic javax.validation.constraints implementation. To
accommodate the use case of a more fine-grain, but more invasive approach,
there is Option 2 and 3. All of which are using the same internal plumbing
to get the job done.

As an added bonus that will introduce even more fluidity to the
"customizable" concept you can use the javax.validation.Constraint that
allows you to do something like:

public @interface MyValidation {

public class Person {


public class Person {
	private String phoneNumber;

-----Original Message-----
From: openjfx-dev-bounces at
[mailto:openjfx-dev-bounces at] On Behalf Of Tom Eugelink
Sent: Tuesday, June 12, 2012 1:45 PM
To: openjfx-dev at
Subject: Re: JavaFX Form Validation

Point being that the validators should be pluggable and customizable, so use
an annotation approach as the basis would be bad. The other way around,
validators that take their cues from annotations, would be good.


On 2012-06-12 19:35, Werner Lehmann wrote:
> Hi Will,
> On 12.06.2012 17:50, Will Hoover wrote:
>> Although, IMHO, the use of validation that doesn't pertain to domain 
>> models is more of an exception to the rule versus the rule itself...
> I suppose most people tend to think that other usecases are the 
> special cases while the own usecase is the common one. There is 
> probably no way to know for sure what the exception is and what it is 
> not. In the end it makes sense to have a framework with as few limitations
as possible.
> Your suggestion assumes that a domain bean backs most UIs (at least 
> when validation is required). I don't think that is true, and I don't 
> like to create a domain bean for the sake of validation.
> Furthermore, not every domain bean property translates to exactly one 
> control. And typically, domain beans do not have JavaFX style properties.
>> The problem with this approach is that it's very redundant. If you 
>> use the same entity/domain model fields in multiple controls (which 
>> happens more frequently than one would think- different forms) then 
>> the developer is left with the responsibility of ensuring the 
>> consistency of the validations across different UI controls.
> Redundancy is bad but: if your validation patterns etc can be 
> discovered automatically (e.g. with your pattern annotation) it should 
> be possible to connect your validation with whatever JavaFX validation 
> we will end up with. Sounds like a form of the mediator pattern. 
> Surely this can be made in a generic way.
> Rgds
> Werner

More information about the openjfx-dev mailing list