net.simplace.util.service.EmailValidator
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
http://javascript.internet.com
This implementation is not guaranteed to catch all possible errors in an email address.
For example, an address like nobody@noplace.d- will pass validator, even though there
is no TLD "d-"
.
public class EmailValidator {
// Protected Constructors
protected EmailValidator();
// Class Methods public static
EmailValidator getInstance();
Returns the Singleton instance of this validator.
returns the Singleton instance of this validator
// Public Instance Methods 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.
returns true if a field has a valid e-mail address
// Protected Instance Methods protected boolean
isValidDomain(String domain);
Returns true if the domain component of an email address is valid.
returns true if the domain component of an email address is valid
protected boolean
isValidUser(String user);
Returns true if the user component of an email address is valid.
returns true if the user component of an email address is valid
protected boolean
isValidIpAddress(Perl5Util ipAddressMatcher);
Validates an IP address. Returns true if valid.
- ipAddressMatcher Pattren matcher
returns true if an IP address is valid
protected boolean
isValidSymbolicDomain(String domain);
Validates a symbolic domain name. Returns true if it's valid.
- domain symbolic domain name
returns true if a symbolic domain name is valid
protected String
stripComments(String emailStr);
Recursively remove comments, and replace with a single space. The simpler
regexps in the Email Addressing FAQ are imperfect - they will miss escaped
chars in atoms, for example.
Derived From Mail::RFC822::Address
returns resulting String
}
Returned by: getInstance()