Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Javadoc @see object method

Tags:

java

javadoc

I would like to link a method of another object using @see from a comment block
@see is only giving me the option to link classes, not methods.

What is the hack?

public class A {
  B bee;

  /**
   * Just invoking methodB on bee.
   * @see B.methodB() <-- There
   */
  public methodA() {
     bee.methodB();
  }
}

public class B {
  /**
   * The real stuff
   */
  public methodB() {
    // real stuff
  }
}
like image 296
MonoThreaded Avatar asked Sep 27 '12 12:09

MonoThreaded


People also ask

What does @SEE do in Javadoc?

We can use the @see and @link tag multiple times in a class, package, or method. The @see tag declares references that point to an external link, class, or method. The @link tag can also be used multiple times for declaring inline links or in contrast with other block tags.

How do you mention a method in Javadoc?

Javadoc provides the @link inline tag for referencing the members in the Java classes. We can think of the @link tag as similar to the anchor tag in HTML, which is used to link one page to another via hyperlinks. Similar to the anchor tag, the path_to_member is the destination, and the label is the display text.

What does @link mean in Java?

It is shorthand that tells the java docs to insert a link to the desired place when they are being viewed. For instance when you view the javadocs for whatever method has that inside your IDE you'll be shown a link that will take you to the KeyEvent.

How do I add a URL to a Javadoc?

@see <a href="URL#value">label</a> : Adds a link as defined by URL#value . The URL#value is a relative or absolute URL. The Javadoc tool distinguishes this from other cases by looking for a less-than symbol ( < ) as the first character.


2 Answers

Use hashes instead of dots, as in: @see B#methodB()

like image 75
Miquel Avatar answered Oct 13 '22 20:10

Miquel


You need to use # instead of .

@see B#methodB()

See the documentation for @see here.

like image 17
Curious Avatar answered Oct 13 '22 20:10

Curious