Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to link JavaDoc to different class?

Tags:

java

javadoc

I'm trying to write a javadoc which displays the javadoc from another method, like:

private List<Object> list;

/**
 * {@link list#indexOf(Object)} 
 */
int getMyIndex(Object o) {
   return list.indexOf(o);
}

This would give me a javadoc link when I use my getMyIndex() method. But what I want is that eclipse just actually shows(!) the javadoc from the method that I referenced in @link.

Of course that's not what link is for. Link does what is should do in this case.

But what do I have to use to somehow "import" a foreign javadoc there?

like image 542
membersound Avatar asked Feb 18 '13 08:02

membersound


People also ask

How do I give a Javadoc a link?

Creating a Link to Javadoc of Another Class To summarize, @link is preferred when we use a class or method name in the description. On the other hand, @see is used when a relevant reference is not mentioned in the description or as a replacement for multiple links to the same reference.

How do I add a Javadoc to a class?

Adding JavaDoc comments The basic rule for creating JavaDoc comments is that they begin with /** and end with */. You can place JavaDoc comments in any of three different locations in a source file: Immediately before the declaration of a public class. Immediately before the declaration of a public field.

Should Javadoc be in interface or implementation?

Sjoerd correctly says that both interface and implementation should have JavaDoc. The interface JavaDoc should define the contract of the method - what the method should do, what inputs it takes, what values it should return, and what it should do in cases of error.


1 Answers

No there isn't any such tag or functionality as far as I know. Refer the javadoc tag list for more details.

From the link

    Tag      |  Introduced in JDK/SDK
-----------------------------------
    @author       1.0
    {@code}       1.5
    {@docRoot}    1.3
    @deprecated   1.0
    @exception    1.0
    {@inheritDoc} 1.4
    {@link}       1.2
    {@linkplain}  1.4
    {@literal}    1.5
    @param        1.0
    @return       1.0
    @see          1.0
    @serial       1.2
    @serialData   1.2
    @serialField  1.2
    @since        1.1
    @throws       1.2
    {@value}      1.4
    @version      1.0
like image 108
mtk Avatar answered Sep 19 '22 15:09

mtk