是否有用于记录泛型类型参数的 javadoc 标签?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/2015972/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Is there a javadoc tag for documenting generic type parameters?
提问by skaffman
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.
我一直在查看 Sun 站点上的 javadoc 文档,试图查找是否有一个 javadoc 标记可用于记录类或方法的通用类型签名。
Something like @typeparam
, similar to the usual @param
, but applicable to types as well as methods,e.g.
类似于@typeparam
,类似于通常的@param
,但适用于类型和方法,例如
/**
* @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?
我怀疑没有这样的标签 - 我在任何地方都找不到它的提及,而且 JavaSE API 文档没有显示任何迹象,但这似乎是一个奇怪的遗漏。有人能把我说对吗?
采纳答案by Timo Willemsen
回答by Dave DiFranco
Yes. Just use the @param tag, and include angle brackets around the type parameter.
是的。只需使用@param 标签,并在类型参数周围包含尖括号。
Like this:
像这样:
/**
* @param <T> This describes my type parameter
*/