{@inheritDoc}
tag is used to inherit the documentation from the nearest inheritable class or
implementable interface into the current documentation comment at this tag's
location.
You
can use @inheritedDoc tag in description block, or in the text arguments of @return,
@param, and @throws tags.
Usage of @inheritDoc
tag in description block
When
you use @inheritDoc tag in description block, the main description is copied
from a class or interface up the hierarchy.
/**
* {@inheritDoc}
*/
@Override
public
void welcomeEmployee(String empName) {
System.out.println("Hello " +
empName);
}
ABCOrg.java
package com.java.tags; /** * * @author Hari Krishna * * @since 1.0 */ public class ABCOrg { /** * Print welcome message to employee. * * @param empName * Employee Name */ public void welcomeEmployee(String empName) { System.out.println("Hello " + empName); } }
XYZOrg.java
package com.java.tags; public class XYZOrg extends ABCOrg{ /** * {@inheritDoc} */ @Override public void welcomeEmployee(String empName) { System.out.println("Hello " + empName); } }
Javadoc
for the class XYZOrg generated like below.
Usage of @inheritDoc
tag in tag descriptions of @return, @param, and @throws
When
you use @inheritDoc tag in tag descriptions of @return, @param and @throws
tags, the tag text is copied from the corresponding tag up the hierarchy.
package com.java.tags; /** * * @author Hari Krishna * * @since 1.0 */ public class ABCOrg { /** * Print welcome message to employee. * * @param empName * Employee Name */ public void welcomeEmployee(String empName) { System.out.println("Hello " + empName); } }
XYZOrg.java
package com.java.tags; public class XYZOrg extends ABCOrg{ /** * Welcome Employee. * * @param empName {@inheritDoc} */ @Override public void welcomeEmployee(String empName) { System.out.println("Hello " + empName); } }
Javadoc
for the class XYZOrg generated like below.
No comments:
Post a Comment