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

com.findwise.hydra.MapConfiguration Maven / Gradle / Ivy

There is a newer version: 0.5.0
Show newest version
package com.findwise.hydra;

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

public class MapConfiguration implements Configuration {
	protected Map map;

	public MapConfiguration() {
		map = new HashMap();
	}

	@Override
	public String getParameter(String key) {
		if (map.containsKey(key)) {
			return map.get(key);
		}
		throw new NoSuchElementException("No setting found for key: " + key);
	}

	public void setParameter(String key, String value) {
		map.put(key, value);
	}

	@Override
	public String getParameter(String key, String defaultValue) {
		if (map.containsKey(key)) {
			return map.get(key);
		}
		return defaultValue;
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy