It can be debated if it is a bug fix or enhancement, but the problem is you cannot use any of the string validators with non-string types. For example, you cannot have StringValidator.maximumLength() or PatterValidator attached to a field of  type UsPhoneNumber.class. Please correct me if I'm wrong. You can use something like MaskConverter, for example, but that's different.

I propose to change the following code in StringValidator:

public void validate(final FormComponent formComponent)
{
  onValidate(formComponent, (String)formComponent.getConvertedInput());
}

with something like onValidate(formComponent, getConvertedInputAsString()) where getConvertedInputAsString() makes call to converter to convert the value back to String.

Alex

Reply via email to