groovy-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "余佳昕" <yjx_yujia...@foxmail.com>
Subject 回复: How to extract comments (especially the fields comments) from groovy or java (compiled in groovy) code?
Date Thu, 23 Jul 2020 03:57:18 GMT
I have written similar software for the company I work for. Java provides an extensible javadoc
API. I have not used it on groovy, but I think it should apply. You can check this class to
get started: `com.sun.tools.javadoc.Main`&nbsp;

Jiaxin


&nbsp;




------------------&nbsp;原始邮件&nbsp;------------------
发件人: "users@groovy.apache.org 杨波"<bo.yang@telecwin.com&gt;; 
发送时间: 2020年7月23日(星期四) 中午11:29
收件人: "users-groovy"<users@groovy.apache.org&gt;; 
主题:   How to extract comments (especially the fields comments) from groovy or java (compiled
in groovy) code?



Hello,


&nbsp; &nbsp; I am writing a grails swagger plugin that needs to extract comments
of class fields, such as below code:


class UserCommand {
&nbsp;&nbsp;&nbsp; /**
&nbsp;&nbsp;&nbsp;&nbsp; * The name of user in comments
&nbsp;&nbsp;&nbsp;&nbsp; */
&nbsp;&nbsp;&nbsp; String username
&nbsp;&nbsp;&nbsp; 
&nbsp;&nbsp;&nbsp; String password
&nbsp;&nbsp;&nbsp; 
&nbsp;&nbsp;&nbsp; String avatarUrl
}


&nbsp;&nbsp;&nbsp; Then I need to extract the comment content "The name of user
in comments" from the code.
I searched the Groovy2.5 AST, but can not find comments related nodes in the node tree.


How can I do this in Groovy 2.5 ? Because grails needs groovy v2.5.


Thanks!


&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 




Best Regards,




Bob Yang
Mime
View raw message