Collection<ValidatorDescriptor> processBeanAttribute(FacesContext context, ValueDescriptor descriptor, String msg,
Class<?>... groups) {
PropertyDescriptor constraintsForProperty = getValidator(context).getConstraintsForClass(descriptor.getBeanType())
.getConstraintsForProperty(descriptor.getName());
if (null != constraintsForProperty) {
ConstraintFinder propertyConstraints = constraintsForProperty.findConstraints();
if (null != groups && groups.length > 0) {
// Filter groups, if required
propertyConstraints = propertyConstraints.unorderedAndMatchingGroups(groups);
}
Set<ConstraintDescriptor<?>> constraints = propertyConstraints // or the requested list of groups)
.getConstraintDescriptors();
// ContextHolder is an arbitrary object, it will depend on the implementation
FacesMessage message = Strings.isEmpty(msg) ? null : new FacesMessage(FacesMessage.SEVERITY_ERROR, msg, msg);
return processConstraints(context, constraints, message);