我应该如何实现“对象查看器/可视化器”?
作为内部测试工具的功能之一,我感兴趣的是允许用户以图形方式查看 Java 对象的字段值。
因此,据我了解,对象的类需要实现可序列化 - 并且根据Effective Java书籍,最好是读/写方法的自定义形式。
这样我就可以使用对象的序列化版本作为查看器的输入(这更多地用于运行后比较和与其他运行的回归类型比较,而不是运行时查看)
如何实现 像这样的事情,尤其是当我 经验几乎为零 开发 Java GUI 应用程序?
有没有相关的框架 适用于 GUI 以及 对于对象可视化部分?
多谢!
As one of the features in an in-house testing tool I'm interested in allowing the user to view the fileds' values of Java objects in a graphical way.
So, as far as I understand, the object's class needs to implement Serializable -and according to Effective Java book, preferably the custom form of the read/write methods.
This way I can use the serialized version of the objects as input for the viewer (this is more for after-run comparisons and regression-type comparisons with other runs rather than run-time viewing)
How does one go about implementing
something like this,especially as I
have close to zero experience in
developing Java GUI applications?Are there any relevant frameworks
available-both for GUI as well as
for the object-visualization part?
Thanks a lot!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我已经使用 XStream 多年了,它的灵活性和速度方面的性能都非常出色。
但是,如果您要使用 Web,那么可以使用 Tapestry 5 的 bean 组件(BeanDisplay, BeanEditForm 和朋友)绝对值得一个快速原型,这些也是非常好的朋友。
I've used XStream for years and it's performance has been great both in flexibility and speed.
But, if you're going web, then something like Tapestry 5's bean components (BeanDisplay, BeanEditForm and friends) are definitely worth a quick prototype these has been very good friends also.
1)我会使用XMLEncoder(http:// /download.oracle.com/javase/1.4.2/docs/api/java/beans/XMLEncoder.html)
2)我会尝试使用类似于UML的东西(因为它是一个很好理解的标准
但是,它必须在 Java GUI 中吗?如果这是一个 Web 应用程序,那么使用 XML 输出器,您可以在 XML 上使用一些相当简单的 XML 样式表 (XSL) 来生成输出。
1) I would use XMLEncoder (http://download.oracle.com/javase/1.4.2/docs/api/java/beans/XMLEncoder.html)
2) I would try to use something similar to UML (as it is a well understood standard
However, does it have to be in Java GUI? If this was a web-application, then using the XML outputter, you could use some reasonably simple XML Stylesheets (XSL) over the XML to produce the output.