Hello everyone, is it possible to retrieve the default value (initializer) from a KSPropertyDeclaration? If so, how?
j
Jiaxiang
01/05/2022, 8:49 PM
KSProperty does not have an API for getting value, so it is not possible.
d
Dutch
01/05/2022, 9:31 PM
That's what I thought, bummer.
Dutch
01/05/2022, 9:49 PM
I guess, even with the
KSClassDecleration
it would still be impossible to retrieve the value, is that correct?
j
Jiaxiang
01/05/2022, 9:56 PM
yes, but how should class have a value to begin with?
Jiaxiang
01/05/2022, 9:56 PM
currently the only way to get a compile time constant value is via
KSValueArgument
👍 1
d
Dutch
01/05/2022, 10:07 PM
Using KSValueArgument and with that Annotations could actually be a good workaround for the time beeing. I guess I will create a new Annotation named @Default with one argument and use that value.
Thank you very much for your help