Search code examples
javajavadoc

Javadoc - how to copy function description?


I have two Java functions:

/**
* Do something with param
*/
public String doSomething(String param) {...};

/**
* ...
*/
public String doSomething(Integer param) {...};

How can I make the second function's description to show an exact copy of the first function?


Solution

  • Assuming copy and paste won't work for you, I believe the convention is to use the @see tag to refer to another method which will give greater detail.

    In your example the doSomething(Integer param) would have an @see tag referring to the String version.

    Wikipedia has some examples, http://en.wikipedia.org/wiki/Javadoc

    As does the oracle site for the javadoc tool http://www.oracle.com/technetwork/java/javase/documentation/index-137868.html#multiple@see