Class EmailValidator

  extended by org.hibernate.validator.constraints.impl.EmailValidator
All Implemented Interfaces:

public class EmailValidator
extends Object
implements ConstraintValidator<Email,String>

Checks that a given string is a well-formed email address.

The specification of a valid email can be found in RFC 2822 and one can come up with a regular expression matching all valid email addresses as per specification. However, as this article discusses it is not necessarily practical to implement a 100% compliant email validator. This implementation is a trade-off trying to match most email while ignoring for example emails with double quotes or comments.

Emmanuel Bernard, Hardy Ferentschik

Constructor Summary
Method Summary
 void initialize(Email annotation)
 boolean isValid(String value, ConstraintValidatorContext context)
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Constructor Detail


public EmailValidator()
Method Detail


public void initialize(Email annotation)
Specified by:
initialize in interface ConstraintValidator<Email,String>


public boolean isValid(String value,
                       ConstraintValidatorContext context)
Specified by:
isValid in interface ConstraintValidator<Email,String>

Copyright © 2007-2011 Red Hat Middleware, LLC. All Rights Reserved