Saturday 20 January 2018

Javadoc: @deprecated: Document deprecated APIS

@deprecated tag is used to document the deprecated APIS. IDEs like Eclipse visualize the deprecated API by cross line on the api name.

Ex
Before adding @deprecated tag to the method ‘areaOfCircle’ in Eclipse.

After adding @deprecated tag to the method ‘areaOfCircle’ in Eclipse. You can observe a line across the method name.
Arithmetic.java

package com.java.tags;

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

 /**
  * The value of PI is {@value}
  */
 public static final double PI = 3.14;

 /**
  *
  * @param radius
  *            radius of the circle
  * 
  * @return area of the circle
  * 
  * @exception IllegalArgumentException
  *                thrown if radius < 0.
  * 
  * @deprecated Do not use this method, use {@link #getAreaOfCircle(int)}
  */
 public double areaOfCircle(int radius) throws IllegalArgumentException;

 /**
  * 
  * @param radius
  *            radius of the circle
  * 
  * @return area of the circle
  */
 public double getAreaOfCircle(int radius);

}

Javadoc is generated like below.



Previous                                                 Next                                                 Home

No comments:

Post a Comment