I want to use an annotation to limit the maximum length of the list to 10. I'm using the @Max
annotation, but it doesn't work. Is there any way to do this?
@Max(value = 10)
private List<String> ipRange;
I want to use an annotation to limit the maximum length of the list to 10. I'm using the @Max
annotation, but it doesn't work. Is there any way to do this?
@Max(value = 10)
private List<String> ipRange;
You must use the @size
annotation as follow @size(max = 10)
because it is the right annotation to check size of lists as reported in the javadoc:
Size range for Arrays, Collections or Maps
Instead the annotation @max must be used to restrict range of numeric values, not sizes of item containers:
max restriction on a numeric annotated element