public class EmailValidator extends Object implements Serializable
Perform email validations.
This class is a Singleton; you can retrieve the instance via the getInstance() method.
Based on a script by Sandeep V. Tamhankar https://javascript.internet.com
This implementation is not guaranteed to catch all possible errors in an email address. For example, an address like nobody@noplace.somedog will pass validator, even though there is no TLD "somedog"
.| Modifier | Constructor and Description |
|---|---|
protected |
EmailValidator()
Protected constructor for subclasses to use.
|
| Modifier and Type | Method and Description |
|---|---|
static EmailValidator |
getInstance()
Returns the Singleton instance of this validator.
|
boolean |
isValid(String email)
Checks if a field has a valid e-mail address.
|
protected boolean |
isValidDomain(String domain)
Returns true if the domain component of an email address is valid.
|
protected boolean |
isValidQueryString(String queryString)
Returns true if the query string component of an email address is valid.
|
protected boolean |
isValidUser(String user)
Returns true if the user component of an email address is valid.
|
protected EmailValidator()
public static EmailValidator getInstance()
public boolean isValid(String email)
Checks if a field has a valid e-mail address.
email - The value validation is being performed on. A null
value is considered invalid.protected boolean isValidDomain(String domain)
domain - being validated.protected boolean isValidUser(String user)
user - being validatedprotected boolean isValidQueryString(String queryString)
queryString - being validatedCopyright © 2017 Java Wikipedia API (Bliki engine). All rights reserved.