Skip to content

Instantly share code, notes, and snippets.

View arifvn's full-sized avatar
🥦
Focusing

arifvn arifvn

🥦
Focusing
View GitHub Profile
@arifvn
arifvn / Car.kt
Last active November 15, 2020 09:07
class Car {
var name:String by Delegate()
var brand:String by Delegate()
var origin:String by Delegate()
}
@arifvn
arifvn / Delegate.kt
Last active November 15, 2020 09:04
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()
}
{
"employees":[
{
"name" : {
"firstName" : "mahera",
"lastName" : "abdi"
},
"isActive" : true,
"age" : 21,
"active" : [ "Monday", "Tuesday" ],