java - Limit the key of a HashMap to a specified length of characters -


i limit size of key hashmap specific size limit.

i tried this:

@valid private map<key, string> views;  public class key { @notblank @size(max = 100) private string key; 

the problem @valid not valid key value of hashmap.

what best way limit key specific size of characters?

you can validate number of characters in key field (private string key;) in setter method, if greater maxlimit, throw exception.


Comments

Popular posts from this blog

google chrome - Developer tools - How to inspect the elements which are added momentarily (by JQuery)? -

angularjs - Showing an empty as first option in select tag -

php - Cloud9 cloud IDE and CakePHP -