How to get a JavaDoc of a method at run time?

前端 未结 5 1978
无人及你
无人及你 2020-11-29 11:51

Its easy to get a method Name of a Class at run time
BUT
How i can get a JavaDoc of a method at run time ?

As the f

5条回答
  •  刺人心
    刺人心 (楼主)
    2020-11-29 12:45

    Annotation processors have access to the Javadoc comments in the source code. If you have control over the compilation process for the classes whose Javadoc you are interested in, you can use an annotation processor to grab the Javadoc at compile-time and make it available later at runtime.

    This is the approach used in the therapi-runtime-javadoc project (disclosure: which I authored and am shamelessly plugging).

提交回复
热议问题