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

org.openbakery.configuration.ConfigurationFromMap.groovy Maven / Gradle / Ivy

Go to download

XCode-Plugin is a plugin to allow custom XCode projects to build as generated by CMake

There is a newer version: 0.0.201
Show newest version
package org.openbakery.configuration

class ConfigurationFromMap implements Configuration {

	Map configurationMap = null

	ConfigurationFromMap(Map configurationMap) {
		if (configurationMap == null) {
			throw new IllegalArgumentException("given configuration map is null")
		}
		this.configurationMap = configurationMap
	}

	@Override
	Object get(String key) {
		return configurationMap[key]
	}

	@Override
	String getString(String key) {

		def value = configurationMap[key]
		if (value instanceof String) {
			return value
		}
		if (value instanceof Boolean) {
			return value.toString()
		}
		if (value instanceof Number) {
			return value.toString()
		}

		return null
	}

	@Override
	List getStringArray(Object key) {
		def value = configurationMap[key]
		if (value instanceof List) {
			return value
		}
		return []
	}

	@Override
	Set getKeys() {
		return configurationMap.keySet()
	}

	@Override
	boolean containsKey(String key) {
		return configurationMap.containsKey(key)
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy