Replace get() and set() to getValue() and setValue() (property delegates)
This commit is contained in:
+1
-1
@@ -5,7 +5,7 @@ class A {
|
||||
}
|
||||
|
||||
object NumberDecrypter {
|
||||
fun get(instance: Any?, data: PropertyMetadata) = when (data.name) {
|
||||
fun getValue(instance: Any?, data: PropertyMetadata) = when (data.name) {
|
||||
"four" -> 4
|
||||
"two" -> 2
|
||||
else -> throw AssertionError()
|
||||
|
||||
+2
-2
@@ -3,11 +3,11 @@ var result: String by Delegate
|
||||
object Delegate {
|
||||
var value = "lol"
|
||||
|
||||
fun get(instance: Any?, data: PropertyMetadata): String {
|
||||
fun getValue(instance: Any?, data: PropertyMetadata): String {
|
||||
return value
|
||||
}
|
||||
|
||||
fun set(instance: Any?, data: PropertyMetadata, newValue: String) {
|
||||
fun setValue(instance: Any?, data: PropertyMetadata, newValue: String) {
|
||||
value = newValue
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -9,7 +9,7 @@ val <T> Value<T>.additionalText by DVal(Value<T>::text) //works
|
||||
val <T> Value<T>.additionalValue by DVal(Value<T>::value) //not work
|
||||
|
||||
class DVal<T, R, P: KProperty1<T, R>>(val kmember: P) {
|
||||
fun get(t: T, p: PropertyMetadata): R {
|
||||
fun getValue(t: T, p: PropertyMetadata): R {
|
||||
return kmember.get(t)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user