I have an annotation like following:
@Arg
internal var stringArg1: String? = null
@Arg
internal var stringArg2: String = "default value"
And I iterate over all of my annotated classes variables like following:
for (e in annotatedElement.enclosedElements) {
if (e.getAnnotation(Arg::class.java) != null) {
val defaultValue = ???
}
}
Question:
Is it possible to get the default value of an annotated variable? In my example I want to retrieve null
and "default value"
for my two variables.