net.n2oapp.framework.ui.context.ConcurrentMapContextEngine Maven / Gradle / Ivy
package net.n2oapp.framework.ui.context;
import net.n2oapp.framework.api.context.ContextEngine;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
public class ConcurrentMapContextEngine implements ContextEngine {
private Map context = new ConcurrentHashMap<>();
@Override
public Object get(String param, Map baseParams) {
return baseParams.getOrDefault(param, context.get(param));
}
@Override
public void set(Map dataSet, Map baseParams) {
context.putAll(dataSet);
}
@Override
public Object get(String name) {
return context.get(name);
}
@Override
public void set(Map dataSet) {
context.putAll(dataSet);
}
}