.jar 到 .cs 类/文件转换技术或实用程序?
我正在寻找一种以代码生成方式将某些类从 Java 转换为 .Net 的方法。
不是在运行时,而是根据需要重新生成一些业务对象(不经常)。
问题是,我想完全控制它们的结局。因此,虽然 java 类具有 get 和 set 方法,但我将从它们中创建一个属性。
我现在能想到的唯一方法是使用 C# 读取文件,获取必要的成员,然后将它们提供给代码生成模板。至少,我可以将它们放入数据库中,像 Code smith 这样的东西可以根据模板和更新的数据库表生成 .net 类。
还有其他想法/实用程序吗?
我的解决方案是使用反射将 java 类成员写为 xml,然后将其插入 codesmith 模板中以创建 .net 类。巧妙的部分是它可以作为构建服务器上的一个步骤自动化
I am looking for a way to transform some classes from Java to .Net in a code gen way.
Not at run time, but re-generate a handful of business objects as needed (not often).
the catch is, i want to have full control of how they end up. So while java classes have get and set methods, i will create a property out of them.
the only way i can think of for now, is to read the file using c#, get the necessary members, and maybe feed them to a code gen template. at the very lease, i could throw them into a database, and something like code smith could generate .net classes based on a template and the updated database table.
any other ideas/utilities?
my solution was to use reflection to write out java class members as xml, and than plugging that into codesmith template to create .net classes. the neat part is that it can be automated as a step on build server
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
看看 IKVM。
Have a look at IKVM.