org.vfd.springboot.validations.validators.EmailValidator Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of springboot-utils Show documentation
Show all versions of springboot-utils Show documentation
Utilities for Spring Boot App
The newest version!
package org.vfd.springboot.validations.validators;
import org.springframework.beans.factory.annotation.Configurable;
import org.vfd.springboot.validations.annotations.Email;
import javax.validation.ConstraintValidator;
import javax.validation.ConstraintValidatorContext;
@Configurable
public class EmailValidator implements ConstraintValidator {
@Override
public boolean isValid(String val, ConstraintValidatorContext constraintValidatorContext) {
if (val == null) return false;
return val.matches("^[A-Za-z]+[A-Za-z0-9_.]*@[A-Za-z]{2,}[A-Za-z-.]*\\.[A-Za-z]{2,3}");
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy