package id.iptek.utms.agent.util;

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

public final class Singleton {

    private final static Map<String, Singleton> INSTANCES = new HashMap<>();
    private Object object;

    private Singleton() {}

    public void setObject(Object object) {
        this.object = object;
    }

    public Object getObject() {
        return object;
    }
    
    public static Singleton getInstance(String name) {
        Singleton instance = INSTANCES.get(name);
        if(instance == null) {
            instance = new Singleton();
            INSTANCES.put(name, instance);
        }
        return instance;
    }
}
