Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Enums ordering in javadoc

The Javadoc for enums always display its constants using alphabetic ordering. Is it possible to change that?

For instance, the javadoc for java.time.DayOfWeek would look better if the constants weren't displayed as FRIDAY, MONDAY, SATURDAY, SUNDAY, THURSDAY TUESDAY, WEDNESDAY...

like image 986
bruno Avatar asked May 23 '14 11:05

bruno


1 Answers

The default HTML doclet sorts the summaries of its members.

Collections.sort(members);

from /com/sun/tools/doclets/internal/toolkit/builders/MemberSummaryBuilder.java :312

It is probably best that you don't do this.

Javadoc puts the summaries in alphabetical order so that you can quickly find the one you want. Breaking that model would make the Javadoc much harder to quickly scan and find what you are looking for.

Alphabetical order only applies to the summary, the full Javadoc will be in the order of decleration in the source file.


If you really needed to do this then you could roll your own doclet or perhaps a taglet might be able to do it.

like image 140
ggovan Avatar answered Oct 01 '22 16:10

ggovan