Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What's the correct way to include an email within Javadoc?

I like to put my email address within @author tags and would like them to be clickable mailto: links in the generated Javadoc.

How should I go about doing this correctly?

/**  * I currently do the following, but would like to have my name   * displayed as the link rather than the email itself.  *  * @author {@link "mailto:[email protected]"}  */ public class Useless { } 

/**  * I've tried this, but get warnings about unexpexted text where my name is.  *  * @author {@link "mailto:[email protected]" "Benoit St-Pierre"}  */ public class Useless { } 
like image 782
Ben S Avatar asked Oct 02 '09 14:10

Ben S


People also ask

What should be included in a Javadoc comment?

Writing Javadoc Comments In general, Javadoc comments are any multi-line comments (" /** ... */ ") that are placed before class, field, or method declarations. They must begin with a slash and two stars, and they can include special tags to describe characteristics like method parameters or return values.

What is Javadoc style?

Javadoc (originally cased JavaDoc) is a documentation generator created by Sun Microsystems for the Java language (now owned by Oracle Corporation) for generating API documentation in HTML format from Java source code.


1 Answers

The {@link} is Javadoc-specific markup. Javadocs, though, are HTML - so you can simply use

/**  * Embed HTML directly into the Javadoc.  *  * @author <a href="mailto:[email protected]">Benoit St-Pierre</a>  */ public class Useless { } 

Whether that's a good idea or not is a different matter. :-)

like image 60
Andrzej Doyle Avatar answered Sep 24 '22 04:09

Andrzej Doyle