Hibernate Books

All times are UTC - 5 hours [ DST ]



Post new topic Reply to topic  [ 1 post ] 
Author Message
 Post subject: Validation of Collection elements?
PostPosted: Fri Aug 20, 2010 5:21 pm 
Newbie

Joined: Thu Jul 05, 2007 5:30 pm
Posts: 8
Hi there,

I am new to BV but it looks very good so far. I think almost every reasonable developer has already implemented something like BV in some way but maybe a little bit smaller or less flexible.
I have no groups and no way of composing constraint-annotations.

However in my implementation I was able to annotate constraints to container types (array, collection or map) so they get applied to each element of the container:

Code:
@ConstraintNotNull
@ConstraintCollection(min=1, max=5, children={
  @ConstraintNotNull
  @ConstraintNumber(min=8080, max=9090)
}
private List<Integer> portRanges;


With my implementation this said that portRanges has to be a List of 1-5 Integers that are in the range [8080, 9090].

How could I express this with BV without creating a class Port that aggregates the int-value?


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 1 post ] 

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.