Commons BeanUtils
  1. Commons BeanUtils
  2. BEANUTILS-304

BeanDiff - encapsulate, apply, and merge bean differences

    Details

      Description

      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.

        Activity

        No work has yet been logged on this issue.

          People

          • Assignee:
            Unassigned
            Reporter:
            Mark Lewis
          • Votes:
            3 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

            • Created:
              Updated:

              Time Tracking

              Estimated:
              Original Estimate - 240h
              240h
              Remaining:
              Remaining Estimate - 240h
              240h
              Logged:
              Time Spent - Not Specified
              Not Specified

                Development