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

com.lx.boot.web.valid.Check Maven / Gradle / Ivy

package com.lx.boot.web.valid;

import com.lx.annotation.Note;
import jakarta.validation.Constraint;
import jakarta.validation.Payload;

import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
import java.util.function.Function;

//说明: 检查参数是否符合要求
/** @author ylx 2022/7/4 15:50 */
@Target({ ElementType.FIELD,ElementType.TYPE,ElementType.PARAMETER}) //字段 和 参数上
@Retention(RetentionPolicy.RUNTIME) //注解保留在程序运行期间,此时可以通过反射获得定义在某个类上的所有注解
@Constraint(validatedBy = CheckValidator.class)
@Note("参数验证!")
public @interface Check {

    @Note("自定义参数!")
    String value() default "";

    @Note("扩展参数")
    String[] ext() default {};

    @Note("根据函数判断是否报错! 示例:com.lx.utils.web.valid.CheckValidatorFunctions")
    Class> function();

    @Note("判断不能为空时的提示信息")
    String message() default "参数不能为空!";

    Class[] groups() default {};

    Class[] payload() default {};
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy