-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 
Author Message
 Post subject: Avoiding DRY in error rendering with class validators
PostPosted: Tue Apr 01, 2008 10:21 pm 
Newbie

Joined: Tue Jul 20, 2004 8:52 pm
Posts: 6
I was reading http://in.relation.to/Bloggers/BeanVali ... onstraints and it says
"As you can see the interface entirely focuses on validation and leaves other concerns such as error rendering to the bean validation provider."
which seem the right thing to do.

My query was with rendering specific error messages when an object isn't valid using a class validator.

Taking the Address class validator as an example. Say the country code was FR and the zip was invalid, and we want the error message to say "Invalid zip code for France".

It would seem then that the validation renderer would need to also have the zip/country service and run the same validation logic again when processing an InvalidConstraint to determine the appropriate error message.

I know if we rewrote our current validations on my project then we would have this situation. Other than that it looks good!

dan


Top
 Profile  
 
 Post subject:
PostPosted: Thu Apr 03, 2008 1:59 pm 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
The message aspect needs to be revisited. sounds like we might have to add some ValidationContext object in isValid() to deal with such cases :(

_________________
Emmanuel


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.