I have one java project in netBeans. There are some packages, and classes in that packages. Can I export this structure to csv?
Example of csv:
myPackage1,MyClass1;
myPackage1,MyClass2;
I would be more pleased if I can put parameters in constructors or voids into that csv.
Thank you for ideas.
EDIT: If there are applications that are able to do reverse engineering to class diagram, there must be some easy way how to do it.
Just create a directory walker algorithm that goes through and finds .java or .class files and adds them to a list of lists (which would be your csv file). If you wanted to add in parameters then you could open the class file, use reflection to see if you can find any constructors and add them as you see fit.
Here try this:
(LOAD)
Assume that your package is a directory (which it is). You will want to walk the
directory looking for all nested .java or .class files and directories. You will
want to either open the java file or load (using the ClassLoader) the class file.
Now from here we will have to branch our algorithm.
(.CLASS BRANCH)
If it is a class file, then you already have all the methods you will need. Use
the java.reflect pacakge you reflectively find the constuctors of the class. Jump
to CREATE CSV.
(.JAVA BRANCH)
However, if it is a java file, then you will have a much harder time. You will
need to create a parser (or find one) that will be able to search for your
constructors and all the other data you want. Then just run all the java files you
through your parser and jump to CREATE CSV
(CREATE CSV)
Now from here you just format the csv file. Take the current directory you are in,
which coincidentally is your package name, paste that into the csv file along with
all the class data you want from the .CLASS BRANCH and the .JAVA BRANCH