开发者

how to implement object merge

I 开发者_如何学Pythonhave composite objects, that compound of other objects. Two clients changed the objects internals in two separate copies, and I want to merge those changes, what is the best approach to do so, and is there a framework to support such operation?

Thanks, Ohad.


If your objects are plain old java beans, then you could use reflection to compare all properties between 2 objects. Commons BeanUtils can help with that.

But you'll have to implement some conflict resolution strategy. If the same property has been changed by both clients. The easiest would be "the-latest-change-wins" strategy - a change with latest "lastUpdateTime" overwrites any other change.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜