https://kotlinlang.org logo
#announcements
Title
# announcements
s

semoro

03/24/2017, 6:51 PM
@marcoferrer You can use something like that:
Copy code
operator fun <T> FieldDelegate.getValue(thisRef: Any?, property: KProperty<*>): T {
    @Suppress("UNCHECKED_CAST")
    return when(property.returnType) {
        String::class -> ""
        Int::class -> 42
        else -> null
    } as T
}
Also please start class names with uppercase 😊
👍 1
m

marcoferrer

03/24/2017, 10:06 PM
Perfect! Thx for help. This pointed me in the right direction.
4 Views