try
{
validator = _binding.getValue(elContext);
} catch (Exception e)
{
throw new ValidatorException(new FacesMessage("Error while creating the Validator"), e);
}
if (validator instanceof Validator)
{
return (Validator) validator;
}
}
Application application = facesContext.getApplication();
Validator validator = null;
try
{
// first check if an ValidatorId was set by a method
if (null != _validatorIdString)
{
validator = application.createValidator(_validatorIdString);
} else if (null != _validatorId)
{
String validatorId = (String) _validatorId.getValue(elContext);
validator = application.createValidator(validatorId);
}
} catch (Exception e)
{
throw new ValidatorException(new FacesMessage("Error while creating the Validator"), e);
}
if (null != validator)
{
if (null != _binding)
{
_binding.setValue(elContext, validator);
}
return validator;
}
throw new ValidatorException(new FacesMessage("validatorId and/or binding must be specified"));
}