Class AbstractEmailValidator<A extends Annotation>
- java.lang.Object
-
- org.hibernate.validator.internal.constraintvalidators.AbstractEmailValidator<A>
-
- All Implemented Interfaces:
ConstraintValidator<A,CharSequence>
- Direct Known Subclasses:
EmailValidator,EmailValidator
public class AbstractEmailValidator<A extends Annotation> extends Object implements ConstraintValidator<A,CharSequence>
Checks that a given character sequence (e.g. 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.
- Author:
- Emmanuel Bernard, Hardy Ferentschik, Guillaume Smet
-
-
Constructor Summary
Constructors Constructor Description AbstractEmailValidator()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanisValid(CharSequence value, ConstraintValidatorContext context)Implements the validation logic.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface jakarta.validation.ConstraintValidator
initialize
-
-
-
-
Method Detail
-
isValid
public boolean isValid(CharSequence value, ConstraintValidatorContext context)
Description copied from interface:ConstraintValidatorImplements the validation logic. The state ofvaluemust not be altered.This method can be accessed concurrently, thread-safety must be ensured by the implementation.
- Specified by:
isValidin interfaceConstraintValidator<A extends Annotation,CharSequence>- Parameters:
value- object to validatecontext- context in which the constraint is evaluated- Returns:
falseifvaluedoes not pass the constraint
-
-