对于C#,我经常使用CodeSmith,最近还使用了Visual Studio中的T4 generator。
我正在寻找类似于Java的东西,特别是Eclipse插件,因为我所有的Java开发都是使用Eclipse IDE进行的。
发布于 2008-12-27 16:31:56
我使用过Velocity和StringTemplate。Velocity更传统一些(想想JSP/ASP的概念),而StringTemplate看起来更简洁一些。在this Artima interview中描述的某种意义上。两者都是纯模板引擎,如果您想从模型生成完整的代码,则需要围绕它们编写一些代码。
ANTLR在内部使用StringTemplate,这可能对您的工作很有用。
发布于 2015-06-09 01:21:21
您应该尝试Telosys Tools,这是一个使用可定制Velocity模板从现有数据库进行代码生成的Eclipse插件
Eclipse市场:http://marketplace.eclipse.org/content/telosys-tools
教程在这里:https://sites.google.com/site/telosystutorial/
查看另一个关于CodeSmith的问题:Is there any freeware tool available which is like Codesmith?
发布于 2019-08-02 16:14:38
我使用JavaForger从模板生成代码。它解析现有的类,以便您可以在模板中使用该class-data。它既可以创建新类,也可以在现有类中插入代码。您可以根据字符串转换规则(例如myProject/dao/ProductDao.java服务myProject/ => /ProductService.java)确定生成的代码插入的位置。
JavaForger是开源的,使用FreeMarker作为模板引擎,使用JavaParser作为解析器。
https://stackoverflow.com/questions/209987
复制相似问题