suffixMessageKey = CSV_SUFFIX_MESSAGE_ID;
FacesMessage facesMsg = null;
// value must be a String
if (!(value instanceof String)) {
Object[] args = { value };
throw new ValidatorException(MessageUtils.getMessage(FacesMessage.SEVERITY_ERROR, CSV_NOT_STRING_MESSAGE_ID, args));
}
Validator validator = facesContext.getApplication().createValidator(getSubvalidatorId());
if (getSeparator() == null)
setSeparator(DEFAULT_SEPARATOR);
String[] values = null;
try {
values = ((String)value).split(getSeparator());
}
catch (PatternSyntaxException e) {
Object[] args = { getSeparator() };
throw new ValidatorException(MessageUtils.getMessage(FacesMessage.SEVERITY_ERROR, CSV_INVALID_SEPARATOR_MESSAGE_ID, args));
}
// loop through the separated values and validate each one
for (int i = 0; i < values.length; i++) {
if (values[i].trim().length() == 0) {
continue;
}
else try {
validator.validate(facesContext, uiComponent, values[i]);
}
catch (ValidatorException e) {
facesMsg = addMessage(facesMsg, e.getFacesMessage(), i, suffixMessageKey);
}
}
if (facesMsg != null)
throw new ValidatorException(facesMsg);
}