从中间层 Java 类生成 ActionScript 值对象

发布于 2024-07-07 06:21:04 字数 179 浏览 4 评论 0原文

在使用远程处理(通过 BlazeDS)的 Flex / Java 应用程序堆栈中,需要在客户端(在 ActionScript 中)和服务器(在 Java 中)中维护用于保存在客户端和服务器之间来回传递的数据的类。

我想要一种仅在 Java 中维护这些类的方法,并具有由构建过程生成的相应 ActionScript 值对象类。

In a Flex / Java app stack using remoting (via BlazeDS), classes to hold data passed back and forth between client and server need to be maintained in both the client (in ActionScript) and server (in Java).

I want a way to maintain theses classes in Java only, and have the corresponding ActionScript value object classes generated by the build process.

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

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

发布评论

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

评论(4

怎樣才叫好 2024-07-14 06:21:04

查看 Granite Data Services 项目中的 AS3 生成器:

http://www.graniteds.org

如果我记得的话正确地说,它是一个 Eclipse 插件,应该非常容易使用。 请记住,如果您从 ActionScript 类中排除某个属性,则在将其发送回 Flex 客户端时,Blaze 仍会对其进行序列化。

Check out the AS3 generator from the Granite Data Services project:

http://www.graniteds.org

If I recall correctly it's an Eclipse plugin which should be quite easy to use. Just remember that if you exclude a property from the ActionScript class that it will still be serialized by Blaze when it's sent back to the Flex client.

帅冕 2024-07-14 06:21:04

XDoclet2 包含一个 ActionScript 插件,可以从 Java 代码中的 Javadoc 注释生成 ActionScript 类。

缺点是它基于 Javadoc 而不是 Java 注释,并且似乎没有详细记录或广泛使用。

XDoclet2 includes an ActionScript plugin that can generate ActionScript classes from Javadoc comments in Java code.

The downside is that it's based on Javadoc rather than Java annotations, and does not appear to be well-documented or very widely used.

你好,陌生人 2024-07-14 06:21:04

有几个免费的 Java 到 AS3 转换器,质量各不相同:

我不能保证他们的质量,但他们声称可以做您正在寻找的事情。

就我个人而言,我承担手动维护两个代码库的开销,因为一旦对象稳定下来,就没有太多事情可做,这意味着我对对象中的其余代码没有复杂的规则。

另外,我的 Java 对象都有 getter 和 setter,而 AS3 等效对象则没有,这意味着公共/私有访问器在任何情况下都是不同的。

华泰

There are a couple of free Java to AS3 converters out there of varying quality:

I cannot vouch for their quality but they claim to do what you are looking for.

Personally I take the overhead of maintaining the two code bases manually because once the objects settle there is not much to do and it means I don't have complex rules around the rest of the code which is in the objects.

Plus my Java objects all have getters and setters whereas the AS3 equivalents do not, which means the public/private accessors are different in any case.

HTH

另类 2024-07-14 06:21:04

如果您打算开发任何复杂程度的 Flex RIA 应用程序,那么您可能会实现 MVC 模式 - 例如 Cairngorm、Mate 或 PureMVC。

看一下这个 Flex 代码生成器,因为它预测您在 Flex 客户端中使用 MVC,并生成适当的代码以提供更高程度的利用:

FCG:Flex 代码生成器

If you're going to be doing a Flex RIA app of any degree of sophistication, then you'll probably be implementing the MVC pattern - ala Cairngorm, Mate, or PureMVC.

Take a look at this Flex code generator as it anticipates your use of MVC in the Flex client and generates code suitably to deliver an even higher degree of leverage:

FCG : a Flex Code Generator

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