com.firefly.net.tcp.codec.flex.stream.impl.LazyContextAttribute Maven / Gradle / Ivy
package com.firefly.net.tcp.codec.flex.stream.impl;
import com.firefly.net.tcp.codec.flex.stream.ContextAttribute;
import com.firefly.utils.concurrent.LazyInitProperty;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;
/**
* @author Pengtao Qiu
*/
public class LazyContextAttribute implements ContextAttribute {
protected LazyInitProperty> attributes = new LazyInitProperty<>();
@Override
public Map getAttributes() {
return attributes.getProperty(ConcurrentHashMap::new);
}
@Override
public void setAttribute(String key, Object value) {
getAttributes().put(key, value);
}
@Override
public Object getAttribute(String key) {
return getAttributes().get(key);
}
}