mtkilbay
mtkilbay

Reputation: 121

Javadoc tag for showing doc of another method

Is there a javadoc tag for showing the doc of another method? These are methods that simply relay the calls to other classes' methods. I'm looking for more than @see. Thanks.

Upvotes: 6

Views: 2560

Answers (2)

Andy Thomas
Andy Thomas

Reputation: 86381

There is no mechanism to include the documentation of any arbitrary method.

However, you can inherit documentation from the same method declared in the nearest superclass or interface, using the tag {@inheritDoc} in the method comment, and/or in the @param, @return and @throws tag.

For example:

public class Foo {
  /** Implements the equals method for Foo objects.
   *  <p>Follows the contract specified by {@link java.lang.Object#equals(Object)}:</p>
   *
   * {@inheritDoc}
   *
   * @param obj {@inheritDoc}
   * @return {@inheritDoc}
   */
  public boolean equals(Object obj) {
     ...
  }
  ...
}

Upvotes: 4

SantiBailors
SantiBailors

Reputation: 1634

If you use {@link MyClass#myMethod(String, etc.)}, the tooltip will show that as clickable and when clicked it will show the JavaDoc of myMethod. You can also add a description before the }.

Upvotes: 6

Related Questions