• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

New forum feature - linking to javadocs

 
Ulf Dittmer
Rancher
Pie
Posts: 42967
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yesterday we updated the forum software so that it now supports creating links to the javadocs of many
Java libraries. That's what the "Javadoc" button is for that you see during writing a post or a reply. If you write [javadoc]java.lang.String[/javadoc], then it will automatically be replaced by a link to the appropriate page of the javadocs: java.lang.String. As a shortcut, it's possible to write [javadoc]String[/javadoc] for classes that are in the java.lang package - somewhat like what the javac compiler does. For all other classes the fully-qualified class name must be used.

This works for many Java projects and libraries: JSE, JEE, JME, JOGL, JMF, JavaHelp, Java3D, JAI, JavaFX, JavaSpeech, most Apache Commons libraries, XMLBeans, Axis 2, XML Crypto, log4j, Lucene, POI, JExcelApi, Struts 1 and 2, JFreeChart, JWebUnit, HttpUnit, HtmlUnit, JUnit 3 and 4, ImageJ, iText 2 and 5, XOM, JChart2D, OpenChart2, Stripes, Wicket, Spring, Seam, Tapestry, WebWork, Quartz, Hibernate 3, QuickTime for Java, Apple's Java extensions, Android, DOM4j, JDOM, Common DOM, MPXJ. If you find one missing that you want to refer to occasionally, just let us know about it, particularly where the javadocs are hosted.

(Update 3/28/09: WSS4J, JAX-RS, Jersey, Tomcat/Jasper 5.5/6 have been added.)

(Update 12/31/09: JEE 6, OSGi 4.2, LWUIT, javax.comm have been added.)

(Update 3/24/2011: Apache Shiro, JNLP, Tomcat 7 have been added.)

For JSE and JEE it's even possible to refer to different versions of the API. Just append a colon and the API version to the class name: [javadoc]String:1.3[/javadoc] turns into java.lang.String while [javadoc]String:6[/javadoc] turns into java.lang.String

Want to know what changed in HttpServletRequest from J2EE 1.2 to JEE 5?
[javadoc]javax.servlet.http.HttpServletRequest:1.2[/javadoc] --> javax.servlet.http.HttpServletRequest
[javadoc]javax.servlet.http.HttpServletRequest:5[/javadoc] --> javax.servlet.http.HttpServletRequest
The supported versions are: JSE - 1.3, 1.4, 5 and 6; JEE - 1.2, 1.3, 1.4, 5 and 6
 
Andrew Monkhouse
author and jackaroo
Marshal Commander
Pie
Posts: 11854
185
C++ Firefox Browser IntelliJ IDE Java Mac Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Really cool feature Ulf - well done!

Best regards, Andrew
 
Treimin Clark
Ranch Hand
Posts: 757
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Great
 
Sridhar Santhanakrishnan
Ranch Hand
Posts: 317
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Too good. One of the best features out here.


 
Balu Sadhasivam
Ranch Hand
Posts: 874
Android Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Thanks Ulf ..Should be really handy rather copy , paste the URL .
 
Sonny Gill
Ranch Hand
Posts: 1211
IntelliJ IDE Mac
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That is a really cool feature. Awesome work, Ulf.

Cheers,
Sonny
 
David O'Meara
Rancher
Posts: 13459
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Nice work, it makes sense having Java API links on a Java site!
 
Campbell Ritchie
Sheriff
Posts: 48382
56
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Works nicely. Thank you.
 
Deepak Bala
Bartender
Posts: 6663
5
Firefox Browser Linux MyEclipse IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That is very cool indeed. The geek in me however is already wondering about the technical gizmo behind the implementation. Perhaps there is a database table of these known classes and it is looked up when a post is published ? Or a cached map that maintains the association in memory. How would it handle a class it does not find, say class BlahBlooBlee. How does it handle class collisions ? Hmm... I ll try that out me thinks

java.lang.BlahBlooBlee

java.lang.String

Another cool feature is that if you highlight the class name and click 'javadoc' the pop up window does not appear and the tag is inserted automatically.

Sorry about the technical questions and test cases. Just curious

[EDIT]

As a shortcut, it's possible to write java.lang.String for classes that are in the java.lang package - somewhat like what the javac compiler does. For all other classes the fully-qualified class name must be used.


I made sense of that now after seeing my published post. Cool feature
 
Vikas Kapoor
Ranch Hand
Posts: 1374
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Deepak,
One of the options is to implement it using pattern. If you look at the URL of API docs it has specific pattern.

Another cool feature is that if you highlight the class name and click 'javadoc' the pop up window does not appear and the tag is inserted automatically.

This is same for all other tags too.
 
Gregg Bolinger
GenRocket Founder
Ranch Hand
Posts: 15302
6
Chrome IntelliJ IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Great work Ulf. Wonderful feature.
 
David O'Meara
Rancher
Posts: 13459
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Vishal Pandya wrote:Deepak,
One of the options is to implement it using pattern. If you look at the URL of API docs it has specific pattern.

This is what I am writing. It should be available soon.
 
Vikas Kapoor
Ranch Hand
Posts: 1374
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
David O'Meara wrote:This is what I am writing. It should be available soon.

I said that for JavaDoc functionality that Ulf has implemented.
 
David O'Meara
Rancher
Posts: 13459
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Except that the two are distinctly different. Ulf's uses an explicit javadoc tag, then matches the start of the package to a javadoc API and provides a link to the class in that API.
The function I am working on detects unlinked Java SE and Java EE classes and adds a link to the default API, and all classes are detected by both the class name and fully qualified class name.

and yes, there is a reason why the functionality is provided via two mechanisms ;)
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have added an entry to the Wiki. I didn't put too much effort in the formatting, so feel free to polish it.
 
Monu Tripathi
Rancher
Posts: 1369
1
Android Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Just started using it. It is really cool!

If I have a leading space in the text that I have selected and If I mark it with javadoc, a link is not created. Can't the spaces be trimmed?
For e.g:
java.lang.VerifyError
 
Ulf Dittmer
Rancher
Pie
Posts: 42967
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
A few enhancements have been added to javadoc linking:

inner class can now be linked: [javadoc]java.util.Map.Entry[/javadoc]

including a hash for a method name is now possible [javadoc]java.util.Map.Entry#equals(java.lang.Object)[/javadoc]

the parentheses can be left out if there are no parameters: [javadoc]String#hashCode[/javadoc]
 
Vijitha Kumara
Bartender
Posts: 3913
9
Chrome Fedora Hibernate
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This is really cool.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic