org.openbakery.configuration.ConfigurationFromMap.groovy Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of xcode-plugin Show documentation
Show all versions of xcode-plugin Show documentation
XCode-Plugin is a plugin to allow custom XCode projects to build as generated by CMake
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)
}
}