Skip to content
This repository has been archived by the owner on Mar 18, 2024. It is now read-only.

get complete qualifier for class #52

Open
henry1986 opened this issue May 11, 2021 · 1 comment
Open

get complete qualifier for class #52

henry1986 opened this issue May 11, 2021 · 1 comment

Comments

@henry1986
Copy link

I'm using an annotation to detect a class where code creation should happen.

Now I did not find any possibility to detect the whole qualifier name.

The only thing I could find was:

fun KtAnnotationEntry.toName() = typeReference?.typeElement?.safeAs<KtUserType>()?.referencedName

But this what only give me the simple name.

Assuming, I have two annotations like: org.my.annotation.example1.FilterAnnotation and org.my.annotation.example2.FilterAnnotation.

How can be distinguished between this two?

Is there at least a possibility to get the imports of the file?

Would be thankful for some help.

Best regards

@raulraja
Copy link
Member

Hi @henry1986 , you may want to look into implementors of TypedQuote. You can then intercept a class and get the typed information through the descriptor API. We don't advertise this API because it's about to change with FIR and we are all waiting to adapt it to that. We have not yet adopted all quotes to be typed quotes but if you are interested in contributing one for annotated elements we can look into that. for now type alias, class, object, property, and named function are named quotes. Thanks!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants