Is it possible to validate a collection of objects in JSR 303 - Jave Bean Validation where the collection itself does not have any annotations but the elements contained within do?
For example, is it possible for this to result in a constraint violation due to a null name on the second person:
List<Person> people = new ArrayList<Person>();
people.add(new Person("dave"));
people.add(new Person(null));
Validator validator = Validation.buildDefaultValidatorFactory().getValidator();
Set<ConstraintViolation<List<Person>>> validation = validator.validate(people);
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…