cn.binarywang.wx.miniapp.util.WxMaConfigHolder Maven / Gradle / Ivy
package cn.binarywang.wx.miniapp.util;
/**
* 小程序存储值存放类.
*
* @author Binary Wang
* created on 2020-08-16
*/
public class WxMaConfigHolder {
private static final ThreadLocal THREAD_LOCAL = new ThreadLocal() {
@Override
protected String initialValue() {
return "default";
}
};
public static String get() {
return THREAD_LOCAL.get();
}
public static void set(String label) {
THREAD_LOCAL.set(label);
}
/**
* 此方法需要用户根据自己程序代码,在适当位置手动触发调用,本SDK里无法判断调用时机
*/
public static void remove() {
THREAD_LOCAL.remove();
}
}