Hi everybody,
I am on my way to re-implement what is provided by javax.validation to allow deep integration with my open source UI framework: http://m-m-m.sourceforge.net/mmm-client/mmm-client-ui/index.html
To prevent reinventing the wheel I always wanted to use javax.validation as it is but the design of the API prevents to do so for what I have tried so far. What I want is that if I bind a UI widget to a bean property then the according validators shall be added automatically by the framework. With javax.validation I can not find a way to validate just a bean property without having it set in the parent bean instance. What I would like to have is a way to get some validator for a given class and property that can just validate the property value (e.g. String, Date, custom Datatype, etc.). Is there a way to do this with JSR 303? I can not find any. Otherwise I am forced to follow the entire design of JSR 303 and first create and populate the beans, then validate them and afterwards go through the constraint violations and try to fiddle some sort of matching these back to widgets. I personally think this is just wrong design. I want to have a widget that accepts the raw datatype and is coulpled with the according validator without itself knowing the parent bean (that was only known by the databinding that created the validators). I have all this running with my own implementation and it is accepting most of the standard JSR 303 constraint annotations but reimplementing custom constraints and logic for groups, etc. would be a lot of wasted effort if I could go with the standard... I can give you deep links into my code at githup if you are interested. Eveything is working in plain java (for JavaFX) as well as with GWT. The GWT port of JSR 303 is also kind of awkward as you have to annotate a list with ALL beans supported by the validator. For such case my own implementation for GWT is a lot more flexibile and easy to use. I already reimplemented many other features of the java world that were simply "not good enough" but as I am doing this all in my spare time I would love to focus on creating new features and added value with my open-source-project (e.g. I spend more than half a year of coding after java5 came out to support reflective property introspection that really supports generics - even today spring and other frameworks fail to do this correct).
BTW: Where can I provide a locale for the validation if I want to do validation on the server-side for a webapp with multi-language support?
Thanks for your feedback Jörg
|