Reputation: 9103
Recently I had a problem with @Named
qualifier in Kotlin. I thought that changing from this:
var boldTypeface: Typeface? = null
[Inject] set
into this
var boldTypeface: Typeface? = null
[Inject Named("bold")] set
or
var boldTypeface: Typeface? = null
[Inject] [Named("bold")] set
would solve my problem. But it didn't, it's not even compiling.
Upvotes: 15
Views: 2268
Reputation: 9103
I had to update my answer since Kotlin improved a lot. Right now I am using Kotlin 1.0 beta 3
To properly set multiple annotations for a property you have to use @field
annotation:
@field:[Inject Named("bold")]
lateinit var boldTypeface: Typeface
Note that I am using lateinit
here so there is no need to use nullable type Typeface?
Upvotes: 35