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

org.nutz.mongo.entity.ZMoEntityHolder Maven / Gradle / Ivy

package org.nutz.mongo.entity;

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

import org.nutz.lang.Strings;

/**
 * 缓存 ZMoEntity 对象
 * 
 * @author zozoh([email protected])
 */
public class ZMoEntityHolder {

    private Map ens;

    public ZMoEntityHolder() {
        ens = new HashMap();
    }

    public ZMoEntity get(String key) {
        return ens.get(key);
    }

    public void add(String key, ZMoEntity en) {
        if (null != en && !Strings.isBlank(key)) {
            en.setKey(key);
            ens.put(key, en);
        }
    }

    public Set keys() {
        return ens.keySet();
    }

    public int count() {
        return ens.size();
    }

    public ZMoEntity remove(String key) {
        return ens.remove(key);
    }

    public void clear() {
        ens.clear();
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy