使用类似于 Javadoc 标记接口的注释
我有一些概念上相关的类,并想用注释标记它们,以便我可以在 javadoc 中看到这些类的列表。
例如,MyAPI 提供一些状态变量:
/**
* Marker for the state types exposed by MyAPI
*/
@Retention(RetentionPolicy.SOURCE)
@Target(ElementType.TYPE)
public @interface MyAPIState {
}
这是这些状态之一:
/**
* Stores connection state.
*/
@MyAPIState
public class ConnectionState {
public boolean isConnected(){...}
}
如果我对这些状态使用空标记接口(而不是注释),我将很容易看到实现类型。但是为 MyAPIState 生成的 javadoc 不会链接到用它注释的类型。
我可以让 javadoc 显示注释的 javadoc 中相关类型的链接吗?
I have some conceptually related classes and want to mark them with annotations so that I can see list of these classes in javadoc.
For example, MyAPI supplies some state variables:
/**
* Marker for the state types exposed by MyAPI
*/
@Retention(RetentionPolicy.SOURCE)
@Target(ElementType.TYPE)
public @interface MyAPIState {
}
And here is one of these states:
/**
* Stores connection state.
*/
@MyAPIState
public class ConnectionState {
public boolean isConnected(){...}
}
Had I used an empty marker interface for these states (instead of the annotation) I would have easily seen the implementing types. But generated javadoc for MyAPIState does not link to the types which are annotated with it.
Can I make javadoc to show links to the related types in the javadoc of the annotation?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
据我所知,如果你不想替换doclet,javadoc没有这样的功能。
除了注释之外,您还可以尝试使用自定义 javadoc 标记并将它们与自定义 taglet 。
这可能看起来像这样:
As far as I know, there is no such feature for javadoc, if you don't want to replace the doclet.
Instead of annotations you could try to use custom javadoc tags and combine them with a custom taglet you implement for this purpose.
This could then look like this: