All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.vfd.springboot.validations.validators.EmailValidator Maven / Gradle / Ivy

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