Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.apache.commons.validator.routines
Class EmailValidator

    java.lang.Object
      org.apache.commons.validator.routines.EmailValidator

All Implemented Interfaces:
  Serializable

    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 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.somedog will pass validator, even though there is no TLD "somedog"

.

Since:
  Validator 1.4
Version:
  $Revision: 1227719 $ $Date: 2012-01-05 18:45:51 +0100 (Thu, 05 Jan 2012) $
See Also:
  Serialized Form

Constructor Summary
`protected` | `EmailValidator(boolean allowLocal)` Protected constructor for subclasses to use.

Method Summary
`static EmailValidator` | `getInstance()` Returns the Singleton instance of this validator.
`static EmailValidator` | `getInstance(boolean allowLocal)` Returns the Singleton instance of this validator, with local validation as required.
`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` | `isValidUser(String user)` Returns true if the user component of an email address is valid.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### EmailValidator

    protected EmailValidator(boolean allowLocal)

  Protected constructor for subclasses to use.

  Parameters:
    `allowLocal` - Should local addresses be considered valid?

Method Detail

### getInstance

    public static EmailValidator getInstance()

  Returns the Singleton instance of this validator.

  Returns:
    singleton instance of this validator.

### getInstance

    public static EmailValidator getInstance(boolean allowLocal)

  Returns the Singleton instance of this validator, with local validation as required.

  Parameters:
    `allowLocal` - Should local addresses be considered valid?
  Returns:
    singleton instance of this validator

### isValid

    public boolean isValid(String email)

  Checks if a field has a valid e-mail address.

  Parameters:
    `email` - The value validation is being performed on. A `null` value is considered invalid.
  Returns:
    true if the email address is valid.

### isValidDomain

    protected boolean isValidDomain(String domain)

  Returns true if the domain component of an email address is valid.

  Parameters:
    `domain` - being validated.
  Returns:
    true if the email address's domain is valid.

### isValidUser

    protected boolean isValidUser(String user)

  Returns true if the user component of an email address is valid.

  Parameters:
    `user` - being validated
  Returns:
    true if the user name is valid.

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2002-2012 The Apache Software Foundation. All Rights Reserved.