Xtra Coder
Xtra Coder

Reputation: 3497

Auto-generate custom JavaDoc comments for overriden methods

I'm looking for the way to enhance readability of my Java sources and would like to add following JavaDoc comment to all overridden methods

/** Overrides {@link com.org.pkg.MyInterface#myMethod}. */
@Override
protected boolean myMethod() {
    ...
}

This will be handy when class implements multiple interfaces as well as overrides some class methods. It is not always clear at first sight "what is what".

The question is - is there some command-line tool or IDE plugin (IDEA, NetBeans, Eclipse) which can automate this?

Upvotes: 2

Views: 2868

Answers (1)

Stéphane
Stéphane

Reputation: 877

Eclipse generates that comment automatically for you when you create the methods

The default template is

/* (non-Javadoc)
 * ${see_to_overridden}
 */

where ${see_to_overridden} is turned into @see com.org.pkg.MyInterface#myMethod

You can change the template in windows->preferences->java->code style->code templates

to add it to an existing method , just type /* and return above the method

I don t know anyway to do that in batch however

Upvotes: 4

Related Questions