Is there a javadoc tag for documenting generic type parameters?

牧云@^-^@ 提交于 2019-11-27 05:23:18

问题


I've been looking through the javadoc documentation on Sun's site, trying to find if there's a javadoc tag which can be used to document a class or method's generic type signature.

Something like @typeparam, similar to the usual @param, but applicable to types as well as methods,e.g.

/**
 *  @typeparam T This describes my type parameter
 */
class MyClass<T> {
}

I suspect there is no such tag - I can find no mention of it anywhere, and the JavaSE API docs don't show any sign of it, but it seems like an odd omission. Can someone put me right?


回答1:


It should be done just like this:

/**
 * @param <T> This describes my type parameter
 */
class MyClass<T>{

}

Source




回答2:


Yes. Just use the @param tag, and include angle brackets around the type parameter.

Like this:

/**
 *  @param <T> This describes my type parameter
 */


来源:https://stackoverflow.com/questions/2015972/is-there-a-javadoc-tag-for-documenting-generic-type-parameters

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!