Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to disable return value as hyperlink using javadoc?

 
Jack Wanes
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I have a method that return a class as return value, but that class does not have any published methods, so this class should not be published either.
I have the following javadoc comments added:

But in generated javadoc, MySampleClass is enabled as a hyperlink that user can click on, web browser cannot display the related page since
MySampleClass is not published. I am wondering how I can disable the hyperlink so it foes not give users false impression that this class is published?

Another weird thing is, the following class return value is not displayed as hyperlink even though I use similar javadoc comments, I cannot figure out
what is playing a role to enable/disable hyperlink here:


thanks,
 
Rob Spoor
Sheriff
Pie
Posts: 20608
63
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If this class is published, and this is the method's actual return type, then that return type is very much published. If you do not want "MySampleClass" to be published it cannot be the return type or parameter type of any published method. You should consider returning a published super class or interface instead.
 
Winston Gutkowski
Bartender
Pie
Posts: 10501
64
Eclipse IDE Hibernate Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Jack Wanes wrote:I have a method that return a class as return value, but that class does not have any published methods, so this class should not be published either.

I'm afraid I'll go further than Rob, and question your design.

First: Returning a class suggests reflection, which is supported in Java via intrinsic classes, but not by the language.

Second: Exposing the existence of a class is not the same as exposing the API of the the class. Personally, I don't like it, but I'm a bit of a purist when it comes to this sort of stuff.

If you are trying to create a reflection-based framework, then you need to understand that it is NOT supported by the language; and therefore any form of documentation based on it.

Winston
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic