-->
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: [VALIDATOR] Map validators
PostPosted: Thu Nov 13, 2008 11:42 am 
Newbie

Joined: Fri Nov 30, 2007 6:29 am
Posts: 14
Location: Oslo
Hi contributers,

I'm trying to validate both the keys an values of a map like this:

Code:
@Valid public Map getMap(){...}


I wrote a test to confirm validation failure, and was surprised to see that the map keys were not validated. There are several use cases where this would be useful, so I don't see why it's not a part of the api.

Is this a bug, or do I have to write something like this to make it work:

Code:
// Validate the values
@Valid public Map getMap{...}

// Validate the keys
@Valid private Set validateMapKeys{...}


(Btw, fixing this is easily done in ClassValidator line 400 and outwards).

Regards,

Eirik


Last edited by eirirlar on Fri Nov 14, 2008 3:54 am, edited 1 time in total.

Top
 Profile  
 
 Post subject: should've looked in the docs
PostPosted: Fri Nov 14, 2008 3:51 am 
Newbie

Joined: Fri Nov 30, 2007 6:29 am
Posts: 14
Location: Oslo
The docs specify this behaviour, but I still think the API could benefit from better collection validators. Here's some from the top of my head:

Code:
java.util.Map:
@MapKeysValid
@MapValuesValid


Any chance any of these will be integrated in the API?


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.