I'm trying to create an annotation which takes the...
# kapt
v
I'm trying to create an annotation which takes the name of a class which implements a particular interface. So far I have
Copy code
interface Converter {
	fun convert(from:String) : Any?
}
@Retention(AnnotationRetention.RUNTIME)
@Target(AnnotationTarget.VALUE_PARAMETER)
annotation class SparkConverter(val converterClass: KClass<Converter>)
implemented by:
Copy code
class MyTimeHourConverter: Converter {
	override  fun convert(hoursString: String): Int {
		return hoursString.toInt()
	}
}
But I can't call it because I have a type mismatch:
Copy code
data class MyTime(@SparkConverter(converterClass = MyTimeHourConverter::class) val hours: Int, val minutes: Int)
Apparently not recognising that
MyTimeHourConverter
does implement the
Converter
interface?