Add ValueProvider.kt

This commit is contained in:
Alexander Nozik 2021-08-10 22:41:06 +03:00
parent 66c708d9fb
commit da9d6e7639

View File

@ -9,9 +9,15 @@ public fun interface ValueProvider {
public fun getValue(name: Name): Value?
}
public fun ValueProvider.getValue(key: String): Value? = getValue(Name.parse(key))
/**
* An object that could consume values
*/
public interface MutableValueProvider: ValueProvider{
public interface MutableValueProvider : ValueProvider {
public fun setValue(name: Name, value: Value?)
}
public fun MutableValueProvider.setValue(key: String, value: Value?) {
setValue(Name.parse(key), value)
}