Saturday 20 January 2018

Javadoc: @see: Document other references

It adds a "See Also" heading with a link or text entry that points to a reference.

Syntax
@see reference

/**
 *
 * @see Math#sqrt(double)
 */
public double sqrt(double number) throws IllegalArgumentException;

Arithmetic.java

package com.java.tags;

/**
 * 
 * @author Hari Krishna
 * 
 * @since 1.0
 */
public interface Arithmetic {

 /**
  * 
  * @param number
  *            number to calculate square root for
  * 
  * @return square root of a number
  * 
  * @throws IllegalArgumentException
  *             if number <= 0
  * 
  * @see Math#sqrt(double)
  */
 public double sqrt(double number) throws IllegalArgumentException;

}

javadoc is generated like below.


Where can I use @see tag?
You can use on top of package, class, interface, constructor, method, or field

What is the difference between {@link} and @see tags?
{@link} tag generates an inline link rather than placing the link in the See Also section

How to reference a member of the current class?
@see #field
@see #method(Type, Type,...)
@see #method(Type argname, Type argname,...)
@see #constructor(Type, Type,...)
@see #constructor(Type argname, Type argname,...)

How to reference a member of other class?
@see Class#field
@see Class#method(Type, Type,...)
@see Class#method(Type argname, Type argname,...)
@see Class#constructor(Type, Type,...)
@see Class#constructor(Type argname, Type argname,...)
@see Class.NestedClass
@see Class

How to reference a member of other package?
@see package.Class#field
@see package.Class#method(Type, Type,...)
@see package.Class#method(Type argname, Type argname,...)
@see package.Class#constructor(Type, Type,...)
@see package.Class#constructor(Type argname, Type argname,...)
@see package.Class.NestedClass
@see package.Class
@see package


Previous                                                 Next                                                 Home

No comments:

Post a Comment