问题
I've got one really big .java class file that has a lot of members. How do I create HTML documentation for this so it shows me the members in order of appearance, without sorting by member type? (methods, constants and variables)
For example if my Java code is:
private int typeOfAction_1; // notice the order: 1,2,3..
public void startAction_2(){
}
private int jobtype_3;
private int jobcount_4;
private void doJob_5(){
}
public void haltAction_6(){
}
Javadoc orders members in alphabetical order and sorted by type, and therefore the relations between members are lost:
int jobcount_4; // notice how the order is lost: 4,3,1..
int jobtype_3;
int typeOfAction_1;
doJob_5()
haltAction_6()
startAction_2()
Also, are there documentation generates with smarter features? like:
- Extraction of nearby comments for methods & variables
- Size of methods - Lines of Code
回答1:
Javadoc's standard doclet does not support customized display order for methods. If you need this feature, you will need to develop a custom doclet (or find an existing one that satisfies your requirements).
There are a number of document generators other than Javadoc that can handle java. doxygen and ROBODoc are two such tools. I believe that both of these tools provide the option for items (e.g. methods) to appear in the same order in the generated documentation as they appear in the source code.
回答2:
Another possible approach would be simply to factor out the members that belong together into a separate class or classes, if they really are that conceptually separate from the other members in the class...
来源:https://stackoverflow.com/questions/1384646/how-to-create-java-documentation-in-order-of-appearance