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 wit
I wrote this generic class:
public class ValidListWrapper {
@Valid
private List list;
public ValidListWrapper(List list) {
this.list = list;
}
public List getList() {
return list;
}
}
If you are using Jackson library to deserialize JSON you can add @JsonCreator annotation on the constructor and Jackson will automatically deserialize JSON array to wrapper object.