private static void callValidators(FacesContext context, UIComponent input, Object convertedValue)
{
if(!(input instanceof EditableValueHolder))
throw new FacesException("param input not of type EditableValueHolder, but of : "+input.getClass().getName());
EditableValueHolder holder = (EditableValueHolder) input;
Validator[] validators = holder.getValidators();
for (int i = 0; i < validators.length; i++)
{
Validator validator = validators[i];
try
{
validator.validate(context, input, convertedValue);
}
catch (ValidatorException e)
{
holder.setValid(false);
FacesMessage facesMessage = e.getFacesMessage();
if (facesMessage != null)
{
facesMessage.setSeverity(FacesMessage.SEVERITY_ERROR);
context.addMessage(input.getClientId(context), facesMessage);
}
}
}
MethodBinding validatorBinding = holder.getValidator();
if (validatorBinding != null)
{
try
{
validatorBinding.invoke(context, new Object[] {context, input, convertedValue});
}
catch (EvaluationException e)
{
holder.setValid(false);
Throwable cause = e.getCause();
if (cause instanceof ValidatorException)
{
FacesMessage facesMessage = ((ValidatorException) cause).getFacesMessage();
if (facesMessage != null)