在Javadoc中包含电子邮件的正确方法是什么?

时间:2009-10-02 14:20:14

标签: java email javadoc

我希望将我的电子邮件地址放在@author代码中,并希望它们在生成的Javadoc中成为可点击的mailto:个链接。

我该如何正确地做到这一点?

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

/**
 * I've tried this, but get warnings about unexpexted text where my name is.
 *
 * @author {@link "mailto:my_email@email.example.com" "Benoit St-Pierre"}
 */
public class Useless { }

1 个答案:

答案 0 :(得分:37)

{@link}是特定于Javadoc的标记。但是,Javadocs是HTML - 所以你可以简单地使用

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

这是否是一个好主意是另一回事。 : - )