Delegated properties by map formated?


#1

Hi,

When using the the standard delegate properties stored in a map is there anyway to define format ?
The ideas is something like:

class User(val map: Map<String, Any?>) {
val name: String by map 
val birtday: String by map "yyyy-MM-dd'T'HH:mm:ss"
}

The idea is to be able able to apply a format when retrieve for the map, for dates or currencies …

Thank you.


#2

You can implement your own delegated property, and implement the data conversion in its getValue() method any way you need.


#3

Ok thank you this makes sense.