package com.leanwo.activiti.util;

/**
 * 线程变量Token
 * @author YangZhiJie 2021-03-30
 *
 */
public class TokenUtil {
	
	private static ThreadLocal<String> TOKEN_CONTEXT_HOLDER = new ThreadLocal<String>();
	
	/**
	 * 从线程获取Token
	 * @return
	 */
	public static String getToken(){
		return TOKEN_CONTEXT_HOLDER.get();
	}
	
	/**
	 * 设置线程的Token
	 * @param token 
	 */
	public static void setToken(String token){
		TOKEN_CONTEXT_HOLDER.set(token);
	}
	
	/**
	 * 清空线程的Token
	 */
	public static void clear(){
		TOKEN_CONTEXT_HOLDER.set(null);
	}
}
