File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Ranch Office and the fly likes New forum feature - linking to javadocs Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » This Site » Ranch Office
Bookmark "New forum feature - linking to javadocs" Watch "New forum feature - linking to javadocs" New topic
Author

New forum feature - linking to javadocs

Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41863
    
  63
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


Ping & DNS - my free Android networking tools app
Andrew Monkhouse
author and jackaroo
Marshal Commander

Joined: Mar 28, 2003
Posts: 11460
    
  94

Really cool feature Ulf - well done!

Best regards, Andrew


The Sun Certified Java Developer Exam with J2SE 5: paper version from Amazon, PDF from Apress, Online reference: Books 24x7 Personal blog
Treimin Clark
Ranch Hand

Joined: Nov 12, 2008
Posts: 757
Great
Sridhar Santhanakrishnan
Ranch Hand

Joined: Mar 20, 2007
Posts: 317
Too good. One of the best features out here.


Balu Sadhasivam
Ranch Hand

Joined: Jan 01, 2009
Posts: 874


Thanks Ulf ..Should be really handy rather copy , paste the URL .
Sonny Gill
Ranch Hand

Joined: Feb 02, 2002
Posts: 1211

That is a really cool feature. Awesome work, Ulf.

Cheers,
Sonny


The future is here. It's just not evenly distributed yet. - William Gibson
Consultant @ Xebia. Sonny Gill Tweets
David O'Meara
Rancher

Joined: Mar 06, 2001
Posts: 13459

Nice work, it makes sense having Java API links on a Java site!
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 38851
    
  23
Works nicely. Thank you.
Deepak Bala
Bartender

Joined: Feb 24, 2006
Posts: 6661
    
    5

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


SCJP 6 articles - SCJP 5/6 mock exams - More SCJP Mocks
Vikas Kapoor
Ranch Hand

Joined: Aug 16, 2007
Posts: 1374
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

Joined: Jul 11, 2001
Posts: 15299
    
    6

Great work Ulf. Wonderful feature.


GenRocket - Experts at Building Test Data
David O'Meara
Rancher

Joined: Mar 06, 2001
Posts: 13459

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

Joined: Aug 16, 2007
Posts: 1374
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

Joined: Mar 06, 2001
Posts: 13459

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

Joined: Nov 24, 2005
Posts: 14687
    
  16

I have added an entry to the Wiki. I didn't put too much effort in the formatting, so feel free to polish it.


[My Blog]
All roads lead to JavaRanch
Monu Tripathi
Rancher

Joined: Oct 12, 2008
Posts: 1369
    
    1

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


[List of FAQs] | [Android FAQ] | [Samuh Varta]
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41863
    
  63
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

Joined: Mar 24, 2008
Posts: 3829

This is really cool.


SCJP 5 | SCWCD 5
[How to ask questions] [Twitter]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: New forum feature - linking to javadocs