Excited still at trying things here, and wanted to show some code from Class Viewer. And experimenting so sorry if established ways of doing things like showing code where I'm winging it. But code snippet is from ClassViewer.java and assume those curious know how to find it, and find where code bloc is within it, if so desired.
Nice, copied over easily, so not going to fiddle with the quick, copy and paste. First is how Class Viewer handles the new format for Java 8 and beyond, which is nice and compact. Second shows how things were handled before and still are for people on earlier versions. Will discuss more after.
if (isNewDocFormat){ tempStr2 = tempStr2.replace('(','-'); tempStr2 = tempStr2.replace(')','-'); tempStr2 = tempStr2.replace(',','-'); tempStr2 = tempStr2.replace("Object[]","Object..."); tempStr2 = tempStr2.replace('[',':'); tempStr2 = tempStr2.replace(']','A'); } else{ if (tempStr2.indexOf(",")!=-1){ StringBuffer buff = new StringBuffer(tempStr2); int pos=0; do{ pos = buff.toString().indexOf(",", pos); //buff.insert(++pos, ' '); buff.insert(++pos, '%'); buff.insert(++pos, '2'); buff.insert(++pos, '0'); }while (buff.toString().indexOf(",", pos)!=-1); tempStr2 = buff.toString(); } }
And that is the heart of the code that is writing out the html for the JavaDoc, I think. Yeah, as just looked at the code and right after this bloc it calls the run browser method. It gets a base and adds, so the base html is already done. Then from here it has written out something like:
http://docs.oracle.com/javase/8/docs/api/java/lang/String.html#valueOf-char:A-int-int-
And that is the code bloc that takes the format from Java language to html so you can just go to a method, where here I've used:
From the String class -- static String valueOf(char[],int,int)
And that was fun! And rather easy, as mostly copied and pasted, without needing to work at it.
James Harris