You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@netbeans.apache.org by Peter Nabbefeld <pe...@gmx.de> on 2021/12/19 10:49:07 UTC

How to find all classes with a specific annotation?

Hello,

I'm looking for how to find all classes with a certain annotation via
Indexer or Java API or even Java refactoring(or whatever module provides
such functionality). How could I find all these classes? My best bet is
probably using
org.netbeans.modules.refactoring.java.plugins.FindLocalUsagesQuery, so
far, but I don't know how to get the javax.lang.model.element.Element
and the org.netbeans.api.java.source.CompilationInfo.

Any help appreciated.

Kind regards,
Peter

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@netbeans.apache.org
For additional commands, e-mail: dev-help@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists




Re: How to find all classes with a specific annotation?

Posted by Peter Nabbefeld <pe...@gmx.de>.
This could be an option, probably, as the "correct" way (I found out
about Metadata APIs) involves friend-only packages. The decision ends up
in in the question, what's more important for me, currently:
investigation of the according NB internals to get a proper API or
getting a quick-and-dirty workaround for what I'm looking for.

As quick-and-dirty implementations tend to cause new problems hidden at
a first glance, I tend to investigate the Metadata APIs further, so I'll
probably be able to provide some feedback on these. Probably this might
lead to implementations without code duplication, but I've not decided
on that point, yet.

Kind regards

Peter



Am 30.12.21 um 18:18 schrieb Eric Bresie:
> Assume it's not quite what is being asked but would Edit...Find in
> Project...Scope (specific project or folder)  *java to search for usage of
> the given "Annotation" in the given project in the code be an alternative?
>
> Eric Bresie
> ebresie@gmail.com
>
>
> On Sun, Dec 19, 2021 at 4:49 AM Peter Nabbefeld <pe...@gmx.de>
> wrote:
>
>> Hello,
>>
>> I'm looking for how to find all classes with a certain annotation via
>> Indexer or Java API or even Java refactoring(or whatever module provides
>> such functionality). How could I find all these classes? My best bet is
>> probably using
>> org.netbeans.modules.refactoring.java.plugins.FindLocalUsagesQuery, so
>> far, but I don't know how to get the javax.lang.model.element.Element
>> and the org.netbeans.api.java.source.CompilationInfo.
>>
>> Any help appreciated.
>>
>> Kind regards,
>> Peter
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: dev-unsubscribe@netbeans.apache.org
>> For additional commands, e-mail: dev-help@netbeans.apache.org
>>
>> For further information about the NetBeans mailing lists, visit:
>> https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists
>>
>>
>>
>>


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@netbeans.apache.org
For additional commands, e-mail: dev-help@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists




Re: How to find all classes with a specific annotation?

Posted by Eric Bresie <eb...@gmail.com>.
Assume it's not quite what is being asked but would Edit...Find in
Project...Scope (specific project or folder)  *java to search for usage of
the given "Annotation" in the given project in the code be an alternative?

Eric Bresie
ebresie@gmail.com


On Sun, Dec 19, 2021 at 4:49 AM Peter Nabbefeld <pe...@gmx.de>
wrote:

>
> Hello,
>
> I'm looking for how to find all classes with a certain annotation via
> Indexer or Java API or even Java refactoring(or whatever module provides
> such functionality). How could I find all these classes? My best bet is
> probably using
> org.netbeans.modules.refactoring.java.plugins.FindLocalUsagesQuery, so
> far, but I don't know how to get the javax.lang.model.element.Element
> and the org.netbeans.api.java.source.CompilationInfo.
>
> Any help appreciated.
>
> Kind regards,
> Peter
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@netbeans.apache.org
> For additional commands, e-mail: dev-help@netbeans.apache.org
>
> For further information about the NetBeans mailing lists, visit:
> https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists
>
>
>
>