class AlbumViewHolder(view: View) : FlowHolder<Album>(view) ...
I have two problems
1.when I used KSAnnotated.annotations, I have got the int value of R.layout.album_medium, Is there any way to get the defined text?
2.I want to get Album class defined by Layout annotation. Could I get it from KSAnnotated? If not, what should I do?
y
yigit
04/07/2022, 4:04 AM
1) i don't think so because the compiler will replace it with the final int value. You cannot use non compile time values in annotations (that code wouldn't compile in a library project)
2) you get them via get symbols annotated with API
h
haoxiqiang
04/07/2022, 4:45 AM
I have try it by debug mode and I check all methods but I not find the api that get the generic from the superclass like
FlowHolder<Album>
haoxiqiang
04/07/2022, 4:46 AM
let me put it another way,
FlowHolder<Album>
, the album class
j
Jiaxiang
04/07/2022, 6:20 PM
You can traverse
KSClassDeclaration.superTypes
and then you can get the individual super types, from where you can call
KSTypeReference.resolve().declaration
to get the class declaration of these super types.