Skip to main content



      Home
Home » Eclipse Projects » Eclipse Platform » How to create a plug-in that uses reflection to find files with annotations ?
How to create a plug-in that uses reflection to find files with annotations ? [message #334591] Thu, 19 February 2009 06:45 Go to next message
Eclipse UserFriend
Hi all,

Here's my problem I have to develop a plug-in that is supposed to find
java files with specific annotations, is it possible to do that using the
java reflection ?

Thanks
Re: How to create a plug-in that uses reflection to find files with annotations ? [message #334602 is a reply to message #334591] Thu, 19 February 2009 17:32 Go to previous messageGo to next message
Eclipse UserFriend
"Julien Manankiandrianana" <jmananki@enib.fr> wrote in message
news:7e37bf21d3c1da64f366524027f911d0$1@www.eclipse.org...
> Hi all,
>
> Here's my problem I have to develop a plug-in that is supposed to find
> java files with specific annotations, is it possible to do that using the
> java reflection ?

I think this is the same question that you already got answered on
eclipse.tools.jdt? If not, please clarify.
Re: How to create a plug-in that uses reflection to find files with annotations ? [message #334609 is a reply to message #334602] Fri, 20 February 2009 04:16 Go to previous messageGo to next message
Eclipse UserFriend
I have a set of .java files and I wanted to know if there's a way to get
the annotated fields using the reflection. Is it possible somehow to
create a model of a class from a java file and get every fields, methods,
etc. ?

>Walter Harley wrote:
> I think this is the same question that you already got answered on
> eclipse.tools.jdt? If not, please clarify.
Re: How to create a plug-in that uses reflection to find files with annotations ? [message #334624 is a reply to message #334609] Fri, 20 February 2009 10:58 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: richkulp.us.NO_SPAM.ibm.com

I wouldn't use reflection, I would use the JDT instead. Reflection
requires the classes to be loaded and you can't load classes from an
Eclipse IDE project into Eclipse.

The JDT does annotation processing on the classes in a project without
loading them as classes.

However, I don't know the API well enough to tell you how to get the
annotations themselves from JDT. Maybe someone else can help out there.

Julien Manankiandrianana wrote:
> I have a set of .java files and I wanted to know if there's a way to get
> the annotated fields using the reflection. Is it possible somehow to
> create a model of a class from a java file and get every fields,
> methods, etc. ?
>
>> Walter Harley wrote:
>> I think this is the same question that you already got answered on
>> eclipse.tools.jdt? If not, please clarify.
>
>

--
Thanks,
Rich Kulp
Re: How to create a plug-in that uses reflection to find files with annotations ? [message #334635 is a reply to message #334609] Fri, 20 February 2009 14:40 Go to previous messageGo to next message
Eclipse UserFriend
"Julien Manankiandrianana" <jmananki@enib.fr> wrote in message
news:02a826ca67b086a6cf4e4925b14c9027$1@www.eclipse.org...
>I have a set of .java files and I wanted to know if there's a way to get
>the annotated fields using the reflection. Is it possible somehow to create
>a model of a class from a java file and get every fields, methods, etc. ?
>
>>Walter Harley wrote:
>> I think this is the same question that you already got answered on
>> eclipse.tools.jdt? If not, please clarify.

As Rich says, it sounds like using JDT (either the AST or the Java Model,
depending on the amount of detail you need) is the right answer. "Create a
model of a class from a Java file and get every field, method, etc." is
precisely what the JDT does.

But I am still confused about why you're asking this question here in
eclipse.platform when you also have an ongoing discussion about what seems
to be the same topic in eclipse.tools.jdt.
Re: How to create a plug-in that uses reflection to find files with annotations ? [message #334646 is a reply to message #334635] Mon, 23 February 2009 03:42 Go to previous message
Eclipse UserFriend
Well I thought JDT wasn't the best solution to do what I wanted that's why
I posted here to see if I could find another way, now that I know JDT is
the best solution I'll stick with it.

> "Julien Manankiandrianana" <jmananki@enib.fr> wrote in message
> news:02a826ca67b086a6cf4e4925b14c9027$1@www.eclipse.org...
>>I have a set of .java files and I wanted to know if there's a way to get
>>the annotated fields using the reflection. Is it possible somehow to create
>>a model of a class from a java file and get every fields, methods, etc. ?
>>
>>>Walter Harley wrote:
>>> I think this is the same question that you already got answered on
>>> eclipse.tools.jdt? If not, please clarify.

> As Rich says, it sounds like using JDT (either the AST or the Java Model,
> depending on the amount of detail you need) is the right answer. "Create a
> model of a class from a Java file and get every field, method, etc." is
> precisely what the JDT does.

> But I am still confused about why you're asking this question here in
> eclipse.platform when you also have an ongoing discussion about what seems
> to be the same topic in eclipse.tools.jdt.
Previous Topic:3.5M5 [viewContribution] action activation by the object selection doesn't work
Next Topic:How to create different CellEditors per row?
Goto Forum:
  


Current Time: Tue Apr 15 01:44:17 EDT 2025

Powered by FUDForum. Page generated in 0.02530 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top