diff --git a/biopet-framework/src/main/scala/nl/lumc/sasc/biopet/core/config/ConfigValue.scala b/biopet-framework/src/main/scala/nl/lumc/sasc/biopet/core/config/ConfigValue.scala index 3fef4e9fb7f2592cc24b242f6dd1bd9ebb7b5c66..3963a683f69a4a5d44f1cb8576d49f3bc6379747 100644 --- a/biopet-framework/src/main/scala/nl/lumc/sasc/biopet/core/config/ConfigValue.scala +++ b/biopet-framework/src/main/scala/nl/lumc/sasc/biopet/core/config/ConfigValue.scala @@ -1,6 +1,6 @@ package nl.lumc.sasc.biopet.core.config -class ConfigValue(val requestIndex:ConfigValueIndex, val foundIndex:ConfigValueIndex, val value:Any) { +class ConfigValue(val requestIndex:ConfigValueIndex, val foundIndex:ConfigValueIndex, val value:Any, val default: Boolean) { def getString = Configurable.any2string(value) def getInt = Configurable.any2int(value) def getDouble = Configurable.any2double(value) @@ -8,14 +8,22 @@ class ConfigValue(val requestIndex:ConfigValueIndex, val foundIndex:ConfigValueI def getMap = Configurable.any2map(value) override def toString: String = { - var output = "requestIndex = " + requestIndex - if (foundIndex == null) output += "'not foundin config, used default'" - else output += ", foundIndex = " + foundIndex + var output = "key = " + requestIndex.key output += ", value = " + value + output += ", requestIndex = (" + requestIndex + ")" + if (foundIndex == null && !default) output += ", found on root of config" + else if(!default) output += ", foundIndex = (" + foundIndex + ")" + else output += ", default value is used" + return output } } object ConfigValue { - def apply(requestIndex:ConfigValueIndex, foundIndex:ConfigValueIndex, value:Any) = new ConfigValue(requestIndex,foundIndex,value) + def apply(requestIndex:ConfigValueIndex, foundIndex:ConfigValueIndex, value:Any) = { + new ConfigValue(requestIndex,foundIndex,value, false) + } + def apply(requestIndex:ConfigValueIndex, foundIndex:ConfigValueIndex, value:Any, default:Boolean) = { + new ConfigValue(requestIndex,foundIndex,value, default) + } }