dimanche 22 décembre 2019

KMutableProperty with and

I want to pass a KMutableProperty1 to a constructor. The problem is that sometimes I need to pass property like this:


class PropertyHandler<D,F>(val prop:KMutableProperty1<D,F>) 

Foo("Asd", "asd@asd.com")

PropertyHandler(Foo::name)
PropertyHandler(Foo::email)

At this case compiler said at PropertyHandler(Foo::email) :

Required KMutableProperty1<Foo,String?>
Found KMutableProperty1<Foo,String>

Is there a method to pass String & String? to this?

thx Zamek





Aucun commentaire:

Enregistrer un commentaire