DPM
DPM

Reputation: 1660

How to refer to an inner class method with its simple name in JavaDoc?

I want to make method reference from documentation, but I know how to do this in this way {@link Main.MainInner.mainInnerMethod()}, but in the documentation the user see Main.MainInner.mainInnerMethod() - it's too long. What if I want the user(of the code) to see only mainInnerMethod()?

I know I can do this {@link Main.MainInner.mainInnerMethod() mainInnerMethod()}, but if I decide to rename mainInnerMethod to someMethod, then the the user will see mainInnerMethod() in the documentation instead of someMethod(), so is there a way to get the simple name of method and put it in the documentation, so if the method is renamed the documentation will be updated too?

I'm just interested, I don't really need this in practical situation.

Upvotes: 1

Views: 2746

Answers (1)

Andreas
Andreas

Reputation: 159165

If the javadoc is on another method of MainInner, then you just specify the method name: {@link #mainInnerMethod()}

If the javadoc is elsewhere, you must give at least the class name. If the class is import'ed, you don't have to qualify it: {@link MainInner#mainInnerMethod()}

Upvotes: 4

Related Questions