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

templates.common.InnerContextHolder.ftl Maven / Gradle / Ivy

There is a newer version: 2.0.4
Show newest version
package ${packageName}.common.context;

import lombok.extern.slf4j.Slf4j;
import ${packageName}.common.enums.InnerEnums;

/**
 * @author Co.
 * @name InnerContextHolder
 * @date 2023/2/22 16:45
 */
@Slf4j
public class InnerContextHolder {

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

    /**
     * 设置是否需要权限认证变量
     */
    public static void setInnerType(InnerEnums enums) {
        CONTEXT_HOLDER.set(enums);
    }

    /**
     * 获得是否需要权限认证变量
     */
    public static InnerEnums getInnerType() {
        return CONTEXT_HOLDER.get();
    }

    /**
     * 清空是否需要权限认证变量
     */
    public static void clearInnerType() {
        CONTEXT_HOLDER.remove();
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy