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

nl.hsac.fitnesse.fixture.fit.MapParameter Maven / Gradle / Ivy

There is a newer version: 5.3.17
Show newest version
package nl.hsac.fitnesse.fixture.fit;

import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

/**
 * Parameter for Maps to be passed from one fixture to another.
 */
public class MapParameter extends HashMap {
    private final static Map INSTANCES = new ConcurrentHashMap();
    private final String key;
    /**
     * Creates new.
     * @param aHeaderName display type name
     * @param aNr instance number
     */
    public MapParameter(String aHeaderName, String aNr) {
        key = aHeaderName + "@" + aNr;
        INSTANCES.put(toString(), this);
    }

    public static MapParameter parse(String value) {
        return INSTANCES.get(value);
    }
    
    public String toString() {
        // ensure unique toString that does not change
        return key;
    }

    /**
     * Clears set of known map parameters (that can be returned by parse()).
     */
    public static void clearInstances() {
        INSTANCES.clear();
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy