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

com.holly.unit.validator.api.context.RequestGroupContext Maven / Gradle / Ivy

There is a newer version: 1.0.7
Show newest version
package com.holly.unit.validator.api.context;

/**
 * 保存控制器的方法上的校验组,group class
 *
 * @author holly
 * @date 2020/11/4 14:31
 */
public class RequestGroupContext {

    private static final ThreadLocal> GROUP_CLASS_HOLDER = new ThreadLocal<>();

    /**
     * 设置临时的校验分组
     *
     * @author holly
     * @date 2020/11/4 14:32
     */
    public static void set(Class groupValue) {
        GROUP_CLASS_HOLDER.set(groupValue);
    }

    /**
     * 获取临时校验分组
     *
     * @author holly
     * @date 2020/11/4 14:32
     */
    public static Class get() {
        return GROUP_CLASS_HOLDER.get();
    }

    /**
     * 清除临时缓存的校验分组
     *
     * @author holly
     * @date 2020/11/4 14:32
     */
    public static void clear() {
        GROUP_CLASS_HOLDER.remove();
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy