package com.engine.salary.common;

import java.util.HashMap;
import java.util.Map;


/**
 * 薪酬上下文
 * <p>Copyright: Copyright (c) 2022</p>
 * <p>Company: 泛微软件</p>
 *
 * @author qiantao
 * @version 1.0
 **/
public class SalaryContext {
    public static ThreadLocal<SalaryContext> context = new ThreadLocal<SalaryContext>();

    private Map<String, Object> map = new HashMap<>();

    public static SalaryContext get() {
        if (null == context.get()) {
            context.set(new SalaryContext());
        }
        return context.get();
    }

    public void setValue(String key, Object value) {
        map.put(key, value);
    }

    public Object getValue(String key) {
        return map.get(key);
    }

    public void removeContext() {
        context.remove();
    }
}