package com.zjrs.appcomm.validation;

import cn.hutool.core.util.StrUtil;

import jakarta.validation.ConstraintValidator;
import jakarta.validation.ConstraintValidatorContext;

/**
 * 纯中文验证
 * @author Pettyfer
 */
public class ChineseValidator implements ConstraintValidator<Chinese, String> {

    @Override
    public boolean isValid(String value, ConstraintValidatorContext constraintValidatorContext) {
        if (StrUtil.isEmpty(value)) {
            return true;
        }
        return value.matches("[^\u4E00-\u9FA5]");
    }
}
