Re[4]: anybody has a tool to extract variable and class names out of Java Business and Java-Struts-ActionForm classes into xml, i.e. a free-marker usable data format?

Daniel Dekany <[email protected]> Fri, 26 Sep 2003 23:11:19 +0200
Newsgroups gmane.comp.text.fmpp
Message-ID <[email protected]>
Friday, September 26, 2003, 9:53:10 PM, Ralf Hauser wrote:

>> -----Original Message-----
>> From: [email protected]
>> [mailto:[email protected]]On Behalf Of Daniel Dekany
>> (temporary acc!)
>> >> > If there was a way to extract the class and private variable
>> >> > names in a fmpp-able manner, this would be significant efficiency
> gain!
>> > ...
>> >>
>> >> It seems to me that it is a question of data-loader... a key point in
>> >> the FMPP design is that it is easily extendable with data-loaders. ...
>> > isn't quite a little bit more than a data loader? Wouldn't this
>> > be closer to the "javac" parser of *.java files and then tapping some of
> the data
>> > structures this javac builds before it starts compiling?
>>
> ...
>> Now, as of the concrete case, I'm not sure if I understand well what do
>> you want, but maybe parsing JSP files to extract "data" from them? I
>> don't know how to do it (right now)... But, it is not an FMPP topic
>> anyway... :)
> I don't want to extract from jsp files, but from *.java files: class names
> and private variable names.
>
> Do you have any experience with that?

.java file parsing? No. But one possibility is that you compile them to
classes with Sun's compiler ("javac" if you invoke it from command
line), and then use CGLIB to examine the resulting .class files. If the
compilation step is inconvenient, then maybe it is not that hard to
write a java program that extract these infos from a Java file... I
mean, it need not be a full-blown Java parser for that, so it is maybe
not that hard. A third possibility is to find a Java parser. I guess
there is Java language parser available for parser-generators as ANTLR
or JavaCC.

-- 
Best regards,
 Daniel Dekany




-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf