package com.ruoyi.common.core.annotation;

import com.ruoyi.common.core.constraints.StringContentValidator;

import javax.validation.Constraint;
import javax.validation.Payload;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

/**
 * @Description: 字符串内容正则校验
 * @Author: liuaini
 * @Create: 2024/07/31 14:25
 * @Version: 1.0
 */
@Target({ElementType.FIELD, ElementType.PARAMETER})
@Retention(RetentionPolicy.RUNTIME)
@Constraint(validatedBy = StringContentValidator.class)
public @interface RegexValid {

    // 提示信息
    String message() default "params incorrect";

    // 字符串正则校验属性
    String regex() default "";

    // 指定字符串值，格式如：01,02,03
    String value() default "";

    Class<?>[] groups() default {};

    Class<? extends Payload>[] payload() default {};

}
