• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

New forum feature - linking to javadocs

 
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
author and jackaroo
Posts: 12200
280
Mac IntelliJ IDE Firefox Browser Oracle C++ Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Really cool feature Ulf - well done!

Best regards, Andrew
 
Ranch Hand
Posts: 757
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Great
 
Ranch Hand
Posts: 317
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Too good. One of the best features out here.


 
Ranch Hand
Posts: 874
Android VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Thanks Ulf ..Should be really handy rather copy , paste the URL .
 
Ranch Hand
Posts: 1211
Mac IntelliJ IDE
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
That is a really cool feature. Awesome work, Ulf.

Cheers,
Sonny
 
Rancher
Posts: 13459
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Nice work, it makes sense having Java API links on a Java site!
 
Marshal
Posts: 79475
379
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Works nicely. Thank you.
 
Bartender
Posts: 6663
5
MyEclipse IDE Firefox Browser Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Ranch Hand
Posts: 1374
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Ranch Hand
Posts: 15304
6
Mac OS X IntelliJ IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 ;)
 
Sheriff
Posts: 14691
16
Eclipse IDE VI Editor Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Rancher
Posts: 1369
1
Android Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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]
 
Bartender
Posts: 4116
72
Mac TypeScript Chrome Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
This is really cool.
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic