All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.zbus.transport.AttributeMap Maven / Gradle / Ivy

There is a newer version: 1.0.0-b1
Show newest version
package io.zbus.transport;
 
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;


public class AttributeMap {  
	private ConcurrentMap attributes = null;
	 
	@SuppressWarnings("unchecked")
	public  V attr(String key) {
		if (this.attributes == null) {
			return null;
		}

		return (V) this.attributes.get(key);
	}

	public  void attr(String key, V value) {
		if(value == null){
			if(this.attributes != null){
				this.attributes.remove(key);
			}
			return;
		}
		if (this.attributes == null) {
			synchronized (this) {
				if (this.attributes == null) {
					this.attributes = new ConcurrentHashMap();
				}
			}
		}
		this.attributes.put(key, value);
	} 
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy