.jar 到 .cs 类/文件转换技术或实用程序? [英] .jar to .cs class/file transform technique or utility?

查看:29
本文介绍了.jar 到 .cs 类/文件转换技术或实用程序?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在寻找一种以代码生成方式将某些类从 Java 转换为 .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).

问题是,我想完全控制他们的结局.因此,虽然 Java 类具有 get 和 set 方法,但我将用它们创建一个属性.

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.

我现在能想到的唯一方法是使用 c# 读取文件,获取必要的成员,然后将它们提供给代码生成模板.在租约时,我可以将它们放入数据库中,像 code smith 这样的东西可以根据模板和更新的数据库表生成 .net 类.

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?

我的解决方案是使用反射将 java 类成员写为 xml,然后将其插入 codesmith 模板以创建 .net 类.简洁的部分是它可以作为构建服务器的一个步骤自动化

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

推荐答案

看看 IKVM.

这篇关于.jar 到 .cs 类/文件转换技术或实用程序?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆