[hibernate-dev] On possible extensions for the validator

Emmanuel Bernard emmanuel at hibernate.org
Fri Oct 15 07:33:08 EDT 2010


Hi,
I'm quite late in the game but I finally had a chance to look at your main paper
http://www.ii.uib.no/publikasjoner/texrap/pdf/2009-389.pdf

I quite like your approach for boolean composition. It is very elegant and can easily be added in a non breaking way to Hibernate Validator and Bean Validation. You guys are already prototyping it, so all good :)

For cross-property validation, Hardy has reflected my position already. That being said, I wonder whether you can write your approach atop a generic class-level constraint @CrossValidation that would look for the properties annotations and behave as expected. That would be a nice way to offer both world to the users. You will need to "group" cross field constraints though: as I see it on the paper, you can only have one group of cross level constraint for a given constraint type per class.

PS: I am not necessarily convinced by the all-but-one property is null use case though. I smells like a bad OO design in the first place that lead to such need. But I can be wrong :)

Emmanuel

On 22 sept. 2010, at 09:08, Federico Mancini wrote:

>  Hi all,
> I am new to the list and I am opening this thread on Emmanuel Bernard's 
> suggestion, in order to
> discuss some possible extensions to the validator (jsr 303) I have been 
> working on with a couple of collegues.
> Mainly it concerns the possibility to extend composition with boolean 
> operators (ex.: A field is either in the range 1-10 OR 20-30 AND 
> notNull)  and allow validation of sets of interdependent properties 
> (ex.: EITHER the name field is notNull OR the surname field is notNull/ 
> AT LEAST 1 field must be filled/etc....).
> 
> A description of the experimental framework we implemented can be found 
> here http://www.ii.uib.no/publikasjoner/texrap/pdf/2009-389.pdf , and 
> some further discussion on the choices we made here 
> http://www.ii.uib.no/~federico/papers/Annotations.pdf.
> 
> I hope this might be of some interest for the Hybernate Validator project,
> but, even if not, it would be nice to get some feedback.
> 
> Thanks,
> Federico Mancini
> _______________________________________________
> hibernate-dev mailing list
> hibernate-dev at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/hibernate-dev





More information about the hibernate-dev mailing list