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

top.jfunc.http.holder.DefaultAttributeHolder Maven / Gradle / Ivy

package top.jfunc.http.holder;

import top.jfunc.common.utils.MapUtil;

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

/**
 * @author xiongshiyan at 2019/6/3 , contact me with email [email protected] or phone 15208384257
 */
public class DefaultAttributeHolder implements AttributeHolder {
    private Map attributes;

    @Override
    public Map getMap() {
        return attributes;
    }

    @Override
    public void setMap(Map attributes) {
        this.attributes = attributes;
    }


    @Override
    public Object get(String key) {
        return null == attributes ? null : attributes.get(key);
    }

    @Override
    public AttributeHolder put(String key, Object value) {
        if(null == this.attributes){
            this.attributes = new HashMap<>(2);
        }
        this.attributes.put(key, value);
        return this;
    }

    @Override
    public Object remove(String key) {
        if(MapUtil.isEmpty(attributes)){
            return null;
        }
        return this.attributes.remove(key);
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy