What tags can I use to document my code?

Asked

Viewed 369 times

13

I’m looking for better ways to document my code in Netbeans.

Besides the tags known and used in Javadoc something caught my attention and aroused my curiosity.

When typing {@ some suggestions of documentation with tags I’ve never seen and I don’t know what it’s for. Some:

{@code}
{@docRoot}
{@link}
{@linkplain}
{@literal}

{@link} would be a tag replacement @link? What are these other tags for?

  • You can refer to the complete list as well as the explanation of the meaning of each one directly on official website.

1 answer

13


You can get a list of major tags of Javadoc on Wikipedia or may obtain in the official documentation.

Tag Description Where to use
@Author Designer the author of the code Class, Interface, Enum
@version Specifies the software version Class, Interface, Enum
@Since Initial date of functionality Class, Interface, Enum Field, Method
@see Link to another part of the documentation Class, Interface, Enum Field, Method
@stop Describes a method parameter Method
@Return Describes the return of a method Method
@Exception Describes an exception to be cast Method
@throws The same as the previous * Method
@deprecated Indicates that the method is obsolete Method
{@inheritDoc} Copies the description of the parent method Overriding Method
{@link Reference} Establishes a link to some resource Class, Interface, Enum Field, Method
{@value #STATIC FIELD} Describes a static grave Static Field

* Usually the tag throws is preferred when the method is checked Exception.

These are the recommendations. Obviously you can use as you want. Many people do not like to use certain tags that do not add relevant information to the documentation. Author is the most obvious of them. Authorship control and creation date should be controlled by version control software. But it depends on the culture of each team.

  • 1

    More or less, it is not outdated, it is choice of the most used. Therefore Linkei the official documentation also.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.