I am developing an API with many identically named methods that differ only in signature, which I think is pretty common. All of them do the same, except that they initialize different default values if the user does not want to specify. As a digestible example, consider
public interface Forest { public Tree addTree(); public Tree addTree(int amountOfLeaves); public Tree addTree(int amountOfLeaves, Fruit fruitType); public Tree addTree(int amountOfLeaves, int height); public Tree addTree(int amountOfLeaves, Fruit fruitType, int height); }
The essential action performed by all these methods is the same; tree planted in the forest. Many important things that my API users should know about adding trees for all of these methods.
Ideally, I would like to write a single Javadoc block that is used by all methods:
In my imagination, the tool could magically choose which of @params is applicable to each of the methods, and thus generate good documents for all methods at once.
With Javadoc, if I understand it correctly, all I can do is essentially copy and paste the same javadoc block five times, having only a slightly different list of parameters for each method. It sounds cumbersome to me, and it's also hard to maintain.
Is there any way? Some extension for javadoc that has such support? Or is there a good reason why this is not supported that I missed?
java javadoc
skrebbel Apr 01 '10 at 7:08 2010-04-01 07:08
source share