【问题标题】:How to link javaDocs between an api class and its implementation?如何在 api 类及其实现之间链接 javaDocs?
【发布时间】:2016-10-01 22:54:44
【问题描述】:

我正忙于让 java Docs 显示在类的实现方面。 我有一个 api 类,其中所有文档都驻留在实现端,没有任何显示。我已经看到它通过 Eclipse 工作,但我们公司的标准是 IntelliJ。 我找不到有关将文档从 api 链接到 implementationaion 的信息,所以我希望我能就如何实现这一目标获得一些帮助

示例 API类

public interface Builder {
/**
 * Adds an interaction to the agents latest interaction.
 * It is stored inside the cahce
 * If the interaction already exists in the list it is moved from its position to the top
 * If the interaction does not exist in the list the eldest interaction is removed and the
 * new interaction is added to the top
 * @param interaction
 * @param amountOfAgentPreviouseInteraction
 */
public void updateInteraction(Interaction interaction, int amountOfAgentPreviouseInteraction);
}

这是我实现方面的 java 文档

并且实现确实实现了该 api 类

@Named
public class BuilderImpl implements Builder {
public void updateInteraction(Interaction interaction, int amountOfAgentPreviouseInteraction){
//Some logic here
}

}

我也尝试过@link@see

这似乎是一项非常简单的任务,但我找不到解决方案。

感谢您的宝贵时间

编辑:好的,所以我忘了提到 api 和实现不在同一个项目中。

【问题讨论】:

  • 如果您同时生成所有Javadoc,它将自动发生。否则,您将需要使用 Javadoc -link 选项将实现类链接回接口类。

标签: java intellij-idea comments javadoc


【解决方案1】:

请尝试在方法实现的文档注释中使用{@inheritDoc}

【讨论】:

  • 我尝试了{@inheritDoc},但没有运气。我看到我的项目的语言级别是 5,所以我将它提高到 8。我也没有提到 api 类在一个完全不同的项目中,然后是实现
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2012-10-24
  • 2012-07-25
  • 1970-01-01
  • 1970-01-01
  • 2021-04-20
  • 2019-09-28
相关资源
最近更新 更多