1

Is it somehow possible to implement a custom validator which handles both T and Iterable<T> objects, where T is either primitive type or object? The goal is to implement only a single ConstraintValidator object instead of two: *ConstraintValidator and *ListConstraintValidator Thank you in advance

nKognito
  • 6,297
  • 17
  • 77
  • 138
  • You can make T an `Object` and do some `instanceof` checks. But you can't handle primitive types. You have to go with the boxed versions. – Flown Nov 09 '15 at 06:30

1 Answers1

0

If the goal is to save code - no, it's not possible.

fdreger
  • 12,264
  • 1
  • 36
  • 42