Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.java.programmer > #35868
| From | Eric Sosman <esosman@comcast-dot-net.invalid> |
|---|---|
| Newsgroups | comp.lang.java.programmer |
| Subject | Re: get methods from source files |
| Date | 2016-10-26 18:22 -0400 |
| Organization | A noiseless patient Spider |
| Message-ID | <nuraaj$ois$1@dont-email.me> (permalink) |
| References | <c9464cd7-1a1c-4cce-abe1-607c90ff4e34@googlegroups.com> <nur9t6$niq$1@dont-email.me> |
On 10/26/2016 6:15 PM, Eric Sosman wrote:
> On 10/26/2016 5:37 PM, Philipp Kraus wrote:
>> Hello,
>>
>> did you know how I can get a method signatures from a full source
>> tree. I want to extract only methods which are implement in classes
>> and abstract classes and put them into a CSV file.
>> I have a full Maven project as input, so I would like to iterate over
>> all *.java files within the src/main/java directory but I cannot
>> instantiate each class and use reflection.
>>
>> My first idea is to use th unix commands find and grep, but I don't
>> know how I can determine the methods. An idea is to extract the line
>> before {} and remove the class and the method bodies first.
>>
>> But did you have an idea for the correct extract command or did you
>> know a tool, which I can use?
>
> I don't know of a ready-made tool (but my knowledge is incomplete).
> However, one way to proceed might be to use the Javadoc tool: It can
> already identify methods, constructors, and so on, and all you need to
> do is get it to produce a different style of output. Output generation
> is handled by "doclets," and there are alternatives to the one that
> generates the familiar HTML, plus an API for further customization.
> Absent a ready-made tool, I'd suggest using Javadoc with a custom
> "back end."
>
> http://www.oracle.com/technetwork/java/javase/documentation/index-jsp-135444.html
Another idea: You could compile all the sources, load each class
file in turn, and use reflection on the Class objects.
--
esosman@comcast-dot-net.invalid
"Don't be afraid of work. Make work afraid of you." -- TLM
Back to comp.lang.java.programmer | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
get methods from source files Philipp Kraus <philipp.kraus.flashpixx@gmail.com> - 2016-10-26 14:37 -0700
Re: get methods from source files Eric Sosman <esosman@comcast-dot-net.invalid> - 2016-10-26 18:15 -0400
Re: get methods from source files Eric Sosman <esosman@comcast-dot-net.invalid> - 2016-10-26 18:22 -0400
Re: get methods from source files Stanimir Stamenkov <s7an10@netscape.net> - 2016-10-30 12:44 +0200
Re: get methods from source files Roedy Green <inquiry@mindprod.com> - 2016-11-03 12:53 -0700
Re: get methods from source files Arne Vajhøj <arne@vajhoej.dk> - 2016-11-03 22:34 -0400
Re: get methods from source files Arne Vajhøj <arne@vajhoej.dk> - 2016-10-26 20:09 -0400
Re: get methods from source files Patrick Roemer <sangamon@netcologne.de> - 2016-10-27 13:10 +0200
Re: get methods from source files Philipp Kraus <philipp.kraus.flashpixx@gmail.com> - 2016-10-30 02:35 -0700
csiph-web