public abstract class AbstractStringValidator extends AbstractValidator<String>
To include the value that failed validation in the exception message you can
use "{0}" in the error message. This will be replaced with the failed value
(converted to string using Object.toString()
) or "null" if the value is
null.
Validator.EmptyValueException, Validator.InvalidValueException
Constructor and Description |
---|
AbstractStringValidator(String errorMessage)
Constructs a validator for strings.
|
Modifier and Type | Method and Description |
---|---|
Class<String> |
getType() |
getErrorMessage, isValid, isValidType, isValidValue, setErrorMessage, validate
public AbstractStringValidator(String errorMessage)
Null and empty string values are always accepted. To reject empty values, set the field being validated as required.
errorMessage
- the message to be included in an InvalidValueException
(with "{0}" replaced by the value that failed validation).public Class<String> getType()
getType
in class AbstractValidator<String>
Copyright © 2021 Vaadin Ltd. All rights reserved.