Hibernate Books

All times are UTC - 5 hours [ DST ]



Post new topic Reply to topic  [ 3 posts ] 
Author Message
 Post subject: common implementation of validators for type parameters?
PostPosted: Sat Jun 10, 2017 1:23 pm 
Regular
Regular

Joined: Mon Aug 07, 2006 6:22 pm
Posts: 66
So, from http://docs.jboss.org/hibernate/stable/ ... onstraints , I see that the default validators don't have a TYPE_USE target, so they can't be used for type parameters. It seems logical that someone would think of writing "@TPNotNull", "@TPPattern", "@TPSize", et cetera (TP = "type parameter"), that simply do the same things, but with the TYPE_USE target.

I was thinking of doing this, but I realized that it's likely that other people have thought of the same thing. Has this been done already in a reusable artifact?


Top
 Profile  
 
 Post subject: Re: common implementation of validators for type parameters?
PostPosted: Wed Jun 14, 2017 3:19 am 
Hibernate Team
Hibernate Team

Joined: Sat Jan 24, 2009 12:46 pm
Posts: 385
I'm not aware of such artifact. Support for container element validation will be standardized in Bean Validation 2.0 (we just passed the Public Review Ballot), i.e. all the built-in constraints will support TYPE_USE as of BV 2.0 and Hibernate Validator 6.0. So you could either try to use hibernate-validator-2.0.0.Beta2.jar (note the group id has changed to org.hibernate.validator) or indeed create type use supporting versions of the constraints yourself if you prefer to stay on 5.x for the time being.

_________________
Visit my blog at http://musingsofaprogrammingaddict.blogspot.com/


Top
 Profile  
 
 Post subject: Re: common implementation of validators for type parameters?
PostPosted: Wed Jun 14, 2017 3:13 pm 
Regular
Regular

Joined: Mon Aug 07, 2006 6:22 pm
Posts: 66
Noted. For now, it was easy enough to implement "@TPSize", "@TPPattern", and "@TPNotNull".


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 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.