if(cachedViolations == null) {
//get the bean descriptor and the property descriptor
BeanDescriptor bean = this.getConstraintsForClass(beanType);
PropertyDescriptor property = bean.getConstraintsForProperty(propertyName);
//get constraints for beanType.propertyName
Set<ConstraintDescriptor<?>> constraints = property.findConstraints().unorderedAndMatchingGroups(groups).getConstraintDescriptors();
//if no constraints are found using those groups, then we must take additional measures,
//namely checking to see if it is a group interface instead of a plain group (see JSR-303
//section 3.4.4. "Implicit Grouping")
if(constraints == null || constraints.isEmpty()) {
for(Class<?> group : groups) {
//get bean descriptor for class
BeanDescriptor groupBean = this.getConstraintsForClass(group);
//get property if it exists on the bean
PropertyDescriptor groupProperty = groupBean.getConstraintsForProperty(propertyName);
//if the bean property exists and is constrained, add the constraints
if(groupProperty != null && groupProperty.hasConstraints()) {
constraints.addAll(groupProperty.getConstraintDescriptors());
}
}
}
//loop and validate