Java Reference
In-Depth Information
ParameterConstraints pc = new
ParameterConstraints();
Method method =
ParameterConstraints.class.getMethod("createStudent",
Student.class);
Object[] params = {null};
Set<ConstraintViolation<ParameterConstraints>>violations
= validator.validateParameters(pc, method,
params);
logger.info("ParameterConstraints-Number
of violations : " + violations.size());
} catch (Exception ex) {
Logger.getLogger(ParameterConstraints.class.getName()).log(Level.SEVERE,
null, ex);
}
}
@Size(max = 2)
public String createStudent(@NotNull Student
std) {
return "123456";
}
}
Support for group conversion
While cascading a data validation, it may happen that the data to validate belongs to
groups that are different from the requested group. For a concrete example, consider
the following two classes Student and Address :
public class Student {
@NotNull
@Size(min = 1, max = 15)
private String id;
Search WWH ::




Custom Search