Skip to content

Instantly share code, notes, and snippets.

@arifvn
Last active November 15, 2020 09:04
Show Gist options
  • Save arifvn/4b4030a35c14a982e5d950997102cf79 to your computer and use it in GitHub Desktop.
Save arifvn/4b4030a35c14a982e5d950997102cf79 to your computer and use it in GitHub Desktop.
class Delegate : ReadWriteProperty<Any, String> {
private var stringResult: String = ""
override fun getValue(thisRef: Any, property: KProperty<*>): String =
stringResult
override fun setValue(thisRef: Any, property: KProperty<*>, value: String) {
val formatedString = "${property.name}'s value is $value"
stringResult = formatedString.toLowerCase().capitalize()
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment