简体   繁体   English

Doxygen如何从泛型接口中的overriden方法继承文档?

[英]Doxygen how to inherit documents from overriden methods in a generic interface?

I have an interface Collection<T extends Item> , and a class that implements that interface Movies implements Collection<Movie> . 我有一个接口Collection<T extends Item> ,以及一个实现该接口的类,它Movies implements Collection<Movie> The interface has a couple of abstract methods for sorting that are overriden by Movies. 该界面有几种抽象方法可供电影覆盖。

What I want to know is, how can I get Doxygen to use the documentation from Collection.sort() and Collection.safeSort() in the class Movies? 我想知道的是,我怎样才能让Doxygen在类电影中使用Collection.sort()和Collection.safeSort()中的文档? It'd be useful to know because then I can write the documentation for the interface, rather than each implementation of the interface. 知道它是有用的,因为那时我可以编写接口的文档,而不是接口的每个实现。 If I could -add- documentation to the overridden methods, that would be great, but that's not 100% necessary. 如果我可以-add-记录被覆盖的方法,那将是很好的,但这不是100%必要的。

INHERIT_DOCS is set to YES by the way, I believe Doxygen is struggling because it implements Collection<Movie> and not Collection<T extends Item> . 顺便说一下, INHERIT_DOCS设置为YES ,我相信Doxygen正在努力,因为它实现了Collection<Movie>而不是Collection<T extends Item>

There appear to be a number of bugs filed against doxygen related to this type of behavior, see the following for some examples: 对于与此类行为相关的doxygen似乎存在许多错误,请参阅以下示例:

For a workaround, you could use @copydoc to bring the documentation in your base class in to your derived class, something like: 对于变通方法,您可以使用@copydoc将基类中的文档放入派生类中,例如:

/**
 * Movies
 */
public class Movies extends Collection<Movie> {
    /**
     * @copydoc Collection<T extends Item>::sort()
     *
     * Additional documentation specific to Movies::sort().
     */
    public void sort(void) { return; }
}

This will allow the documentation in the base class to appear to in the derived class documentation without having to copy it. 这将允许基类中的文档出现在派生类文档中,而无需复制它。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM