[prev in list] [next in list] [prev in thread] [next in thread] 

List:       jakarta-commons-dev
Subject:    [jira] Commented: (BEANUTILS-304) BeanDiff - encapsulate, apply,
From:       "Mark Lewis (JIRA)" <jira () apache ! org>
Date:       2010-07-30 15:32:17
Message-ID: 23024978.88661280503937899.JavaMail.jira () thor
[Download RAW message or body]


    [ https://issues.apache.org/jira/browse/BEANUTILS-304?page=com.atlassian.jira.plug \
in.system.issuetabpanels:comment-tabpanel&focusedCommentId=12894063#action_12894063 ] \


Mark Lewis commented on BEANUTILS-304:
--------------------------------------

I've also found an implementation of BeanDiff \
[here|http://code.google.com/p/beandiff/] (Google Code).

The problem is that one requires the beans to implement an interface, and the other \
requires them to be annotated.  This introduces unnecessary compile-time \
dependencies, and it means you can't use existing beans which have already been \
compiled.  I would've expected it to work more like BeanUtils.copyProperties(dest, \
src) where it can work on any bean.

I did some experimental work on this a while, but I don't remember where I stashed \
it.

> BeanDiff - encapsulate, apply, and merge bean differences
> ---------------------------------------------------------
> 
> Key: BEANUTILS-304
> URL: https://issues.apache.org/jira/browse/BEANUTILS-304
> Project: Commons BeanUtils
> Issue Type: New Feature
> Components: Bean / Property Utils, Bean-Collections, ConvertUtils & Converters, \
> DynaBean Affects Versions: LATER THAN 1.8.4
> Reporter: Mark Lewis
> Fix For: LATER THAN 1.8.4
> 
> Original Estimate: 240h
> Remaining Estimate: 240h
> 
> It would be great to have a way to compare two beans and capture the diff somehow.  \
>                 This is just my initial brainstorm on the idea:
> - The BeanDiff class encapsulates differences between two beans -of the same type-, \
>                 the source bean and the target bean.
> - A BeanDiff instance represents what property assignments would be necessary to \
>                 turn the target bean into the source bean.
> - A BeanDiff can be applied to a target bean, performing the necessary property \
>                 assignments to make its property values exactly match the source \
>                 bean.
> - Two BeanDiff instances can be merged into a single BeanDiff instance, allowing \
>                 multiple source beans to be merged into one target bean.
> - If a conflict would occur during a merge (from a property being assigned two \
>                 different values), a BeanDiffConflictException is thrown.
> - The BeanDiffConflictException contains an array of BeanDiffConflict objects.
> - Each BeanDiffConflict instance represents a single property and the two \
>                 conflicting values that were to be assigned.
> - All these actions would work on DynaBeans as well.
> - +Converters would be able to account for type differences in source and target \
> bean properties.+ An example of how this could be used is when dealing with ORM and \
> optimistic locking.  Knowing exactly which properties have been modified would \
> allow concurrent modification of a bean (record) without fear of reasserting the \
> original values and destroying someone else's changes.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic