0

I just found that @Size also works with primitive arrays.

@Size(...) int[] A

Is there any way to validate each element in A?

Will following blend?

@Size(...) @Min(1) @Max(10) int[] A
Jin Kwon
  • 20,295
  • 14
  • 115
  • 184

1 Answers1

0

When I tried with hibernate-validator which is the RI, I got.

javax.validation.UnexpectedTypeException: HV000030: No validator could be found for constraint 'javax.validation.constraints.Min' validating type 'int[]'. Check configuration for 'solution.arg0'

@Min nor @Max, as you can see, doesn't work with primitive arrays, I think.

I still want to know if there any annotations for each element in a primitive array.

Jin Kwon
  • 20,295
  • 14
  • 115
  • 184