Validator[] facesValidators = input.getValidators();
FacesContext facesContext = context.getFacesContext();
if (facesValidators.length > 0) {
String validatorMessage = (String) component.getAttributes().get("validatorMessage");
boolean beanValidatorsProcessed = false;
FacesValidatorService facesValidatorService = ServiceTracker.getService(facesContext,
FacesValidatorService.class);
for (Validator validator : facesValidators) {
if (validator instanceof BeanValidator || validator instanceof FacesBeanValidator) {
ValueExpression valueExpression = component.getValueExpression(VALUE);
if (null != valueExpression && !beanValidatorsProcessed) {
BeanValidatorService beanValidatorService = ServiceTracker.getService(facesContext,
BeanValidatorService.class);
validators.addAll(beanValidatorService.getConstrains(facesContext, valueExpression,
validatorMessage, getGroups()));
beanValidatorsProcessed = true;
}
} else {
validators.add(facesValidatorService.getValidatorDescription(facesContext, input, validator,
validatorMessage));
}
}
}
return validators;