8
Sono perplesso dall'API javax.validation. Sto scrivendo un semplice test per capirlo:Come si costruisce una ConstraintViolationException?
Sample sample = new Sample();
Set<ConstraintViolation<Sample>> violations = validator.validate(sample);
if (!violations.isEmpty()) {
// Eclipse refuses to let me use my violations variable
throw new ConstraintViolationException(violations);
}
Come devo dichiarare la serie di violazioni in modo da poter usare nel mio costruttore di eccezione?
Il costruttore è stato corretto a partire da Bean Validation 1.1. – Gunnar