Java:合并2“bean”生产一个新的 [英] Java: Merge 2 "beans" to produce a new one
问题描述
我需要从Bean1和Bean2中获取所有字段和集合,有时会应用一些业务逻辑,并生成Bean3(所有bean都是具有相当复杂图形的相同类型的hibernate / domain对象)。
I need to take all the fields and collections from Bean1 and Bean2, sometimes apply some business logic, and produce Bean3 (all beans are hibernate/domain objects of the same type with a reasonably complex graph).
关于如何做到这一点的任何想法?在过去做过类似的事情?
Any thoughts on how to do this? Done something similar in the past?
我的想法:
- Dozer(http ://dozer.sourceforge.net/)
- BeanUtils(http://commons.apache.org/beanutils/)<
-
- 手动解决方案
- 另一个很酷的解决方案?
有什么建议吗?
推荐答案
Dozer是一个很好的bean映射工具。
但是,它当然不会执行任何业务逻辑。
Dozer is a nice bean mapping tool. However, it won't perform any business logic, of course.
我应该不会有问题来实现业务逻辑并依赖Dozer来实现bean映射。这就是我要做的。
I should not be a problem to implement a business logic and to rely on Dozer for bean mapping. This is what I would do.
这篇关于Java:合并2“bean”生产一个新的的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!