Is there a way to produce Javadoc for a subset of public methods? For example by annotating public methods as “not part of the public API”

后端 未结 2 1897
孤独总比滥情好
孤独总比滥情好 2021-01-12 10:22

I know how to produce Javadoc for a subset of classes/interfaces/packages. But is there a way to produce Javadoc for only a subset of public methods?

What I would pr

2条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2021-01-12 10:41

    If you are not tied to javadoc, you could alternatively try doxygen with conditional sections:

    public class SomeClass {
        /// @cond API1
        /**
         * This method can be called as part of API1 only.
         */
        public void method() { ... }
        /// @endcond
    
        /// @cond (API1 || API2)
        /**
         * This method can be called as part of API1 or API2.
         */
        public void method2() { ... }
        /// @endcond
    }
    

    When you group the methods appropriately, you can also limit the number of required @cond statements.

    The methods which are actually included can then be selected by the ENABLED_SECTIONS configuration option when creating the documentation.

提交回复
热议问题