jean
03/03/2023, 10:33 AM@MyAnnotation
class MyConfig : Config {
override val configField1: String = "a"
override val configField2: String = "b"
}
Is it possible to get “a” out of ksClassDeclaration?jean
03/03/2023, 1:37 PM@Config
fun myConfig() = ConfigData(
configField1 = String = "a"
configField2 = String = "b"
)
Is there a way to execute that function to get a hold on ConfigData
? I tried this (this as () -> ConfigData).invoke()
but it gave me com.google.devtools.ksp.symbol.impl.kotlin.KSFunctionDeclarationImpl cannot be cast to kotlin.jvm.functions.Function0
.
I know I can get values from annotation arguments but I find it pretty ugly to have code such as this :
@Config(
configField1 = String = "a"
configField2 = String = "b"
)
object MyConfig
I don’t think it scales very wellglureau
03/03/2023, 1:45 PMjean
03/03/2023, 1:56 PMJiaxiang
03/03/2023, 9:55 PMjean
03/04/2023, 9:34 AM