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

org.vfd.springboot.validations.validators.TextValidator 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.Text;

import javax.validation.ConstraintValidator;
import javax.validation.ConstraintValidatorContext;

@Configurable
public class TextValidator implements ConstraintValidator {
    @Override
    public boolean isValid(String val, ConstraintValidatorContext constraintValidatorContext) {
        if (val == null) return false;
        return val.matches("^[A-Za-z]{2,}");
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy