寻找Java代码生成引擎

发布于 2024-11-28 14:13:08 字数 172 浏览 1 评论 0原文

我正在寻找好的(java)代码生成引擎。 我找到了 cglib 但它的文档非常少,我不太确定它是否可以生成实际的 java 类(文件)并且仅动态类。如果我错了,也许有人知道有一个示例的链接。

I am looking for nice (java) code generation engine.
I have found cglib but it is very poorly documented and I am not quite sure that it can generate actual java classes (files) and only dynamic classes. If I am wrong maybe someone knows has a link with an example.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

心头的小情儿 2024-12-05 14:13:08

看看 codemodel,它在我的项目中成功使用。

Have a look at codemodel, used with success for my projects.

不语却知心 2024-12-05 14:13:08

没有真正尝试过,但您可能想看看另一个称为 Javassist 的代码生成 Java 框架,它也有相当全面的 教程。 Hibernate还将代码生成框架从cglib更改为javassist。引用并解释原因:

事实很简单,CGLIB 的开发已基本停止。它发生了。开发人员出于某种原因(原因是他们自己的)转向新的优先事项。

来源

Didn't really try, but you may want to take a look at another code generation Java framework called Javassist, which also has pretty thorough tutorial. Also Hibernate changed code generation framework from cglib to javassist. Quote, explaining why:

The simple fact of the matter is that development on CGLIB has largely stopped. It happens. Developers for whatever reason (the reasons are their own) move on to new priorities.

Source

饭团 2024-12-05 14:13:08

我刚刚在这里发布了 cgV19: https://github.com/carstenSpraener/cgV19 它基于代码我在 2002 年至 2006 年编写的生成器,目前仍在生产中使用。 cgV19 是吸取经验教训的重新实施。它具有:

  • 支持 gradle
  • 使用 Groovy 作为模板语言
  • 模块化“墨盒”系统,可以为不同方面添加多个生成器
  • 占用空间小

只要尝试一下并给我反馈就非常好。

I just released cgV19 here: https://github.com/carstenSpraener/cgV19 it's based on a code generator i wrote in 2002 to 2006 and which is still in production use. cgV19 is a re implementation with lessons learned. It has:

  • Support for gradle
  • Uses Groovy as a template language
  • a modular "cartridge" system to add several generator for different aspects
  • small footprint

Just try it out and give me feedback would be very nice.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文