@SuppressWarnings({"unchecked"})
protected void collectAnnotationChecks(List<Check> annChecks, Class targetType, String targetName, Annotation[] annotations) {
for (Annotation annotation : annotations) {
Constraint c = annotation.annotationType().getAnnotation(Constraint.class);
if (c == null) {
continue;
}
Class<? extends ValidationConstraint> constraintClass = c.value();
ValidationConstraint vc;
try {
vc = newConstraint(constraintClass, targetType);
} catch (Exception ex) {
throw new VtorException("Unable to create constraint: " + constraintClass.getClass().getName(), ex);
}
vc.configure(annotation);
Check check = new Check(targetName, vc);
copyDefaultCheckProperties(check, annotation);
annChecks.add(check);
}
}