-->
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: Multiple @Size according to group
PostPosted: Wed Mar 21, 2012 12:09 pm 
Newbie

Joined: Wed Mar 14, 2012 8:05 am
Posts: 3
Hibernate Validator

I have a property with a @Size annotation on it. But this size is different according to the group it belongs to.

example:
@Size( min = 1, max = 1, groups = Filter1Group.class )
@Size( min = 2, max = 2, groups = Filter2Group.class )
@Size( min = 1, max = 99, groups = Filter3Group.class )
public String myField(){}

Is something like this possible? Or do I have to create a custom validation?


Top
 Profile  
 
 Post subject: Re: Multiple @Size according to group
PostPosted: Fri Mar 23, 2012 5:40 am 
Hibernate Team
Hibernate Team

Joined: Thu Apr 05, 2007 5:52 am
Posts: 1689
Location: Sweden
Hi,

Code:
@Size.List({
   @Size( min = 1, max = 1, groups = Filter1Group.class ),
   @Size( min = 2, max = 2, groups = Filter2Group.class ),
   @Size( min = 1, max = 99, groups = Filter3Group.class )
})
public String myField(){}


--Hardy


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.