final AnnotationConstraintBuilder<A> builder =
new AnnotationConstraintBuilder<A>(constraintClasses, validator, annotation, owner, access);
// JSR-303 3.4.4: Add implicit groups
if (prop != null && prop.getParentMetaBean() != null) {
MetaBean parentMetaBean = prop.getParentMetaBean();
// If:
// - the owner is an interface
// - the class of the metabean being build is different than the
// owner
// - and only the Default group is defined
// Then: add the owner interface as implicit groups
if (builder.getConstraintValidation().getOwner().isInterface()
&& parentMetaBean.getBeanClass() != builder.getConstraintValidation().getOwner()
&& builder.getConstraintValidation().getGroups().size() == 1
&& builder.getConstraintValidation().getGroups().contains(Default.class)) {
Set<Class<?>> groups = builder.getConstraintValidation().getGroups();
groups.add(builder.getConstraintValidation().getOwner());
builder.getConstraintValidation().setGroups(groups);