Skip to content
Snippets Groups Projects
Commit bbc21279 authored by Peter van 't Hof's avatar Peter van 't Hof
Browse files

Added default flag

parent 7d27887a
No related branches found
No related tags found
No related merge requests found
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)
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment