Package com.vaadin.flow.data.validator
Class EmailValidator
java.lang.Object
com.vaadin.flow.data.validator.AbstractValidator<String>
com.vaadin.flow.data.validator.RegexpValidator
com.vaadin.flow.data.validator.EmailValidator
- All Implemented Interfaces:
Validator<String>,Serializable,BiFunction<String,ValueContext, ValidationResult>
A string validator for e-mail addresses. The e-mail address syntax is not
complete according to RFC 822 but handles the vast majority of valid e-mail
addresses correctly.
- Since:
- 1.0.
- Author:
- Vaadin Ltd
- See Also:
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionEmailValidator(String errorMessage) Creates a validator for checking that a string is a syntactically valid e-mail address.EmailValidator(String errorMessage, boolean allowEmpty) Creates a validator for checking that a string is a syntactically valid e-mail address. -
Method Summary
Methods inherited from class com.vaadin.flow.data.validator.RegexpValidator
apply, toStringMethods inherited from class com.vaadin.flow.data.validator.AbstractValidator
getMessage, toResultMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface java.util.function.BiFunction
andThen
-
Field Details
-
PATTERN
- See Also:
-
-
Constructor Details
-
EmailValidator
Creates a validator for checking that a string is a syntactically valid e-mail address.This constructor creates a validator which doesn't accept an empty string as a valid e-mail address. Use
EmailValidator(String, boolean)constructor withtrueas a value for the second argument to create a validator which accepts an empty string.- Parameters:
errorMessage- the message to display in case the value does not validate.- See Also:
-
EmailValidator
Creates a validator for checking that a string is a syntactically valid e-mail address.- Parameters:
errorMessage- the message to display in case the value does not validate.allowEmpty- iftruethen an empty string passes the validation, otherwise the validation fails
-
-
Method Details
-
isValid
Description copied from class:RegexpValidatorReturns whether the given string matches the regular expression.- Overrides:
isValidin classRegexpValidator- Parameters:
value- the string to match- Returns:
- true if the string matched, false otherwise
-