commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Nelson, Laird" <Laird.Nel...@FMR.COM>
Subject [BeanUtils] "Diff" for beans?
Date Wed, 29 Jan 2003 18:36:59 GMT
For some rather absurd reasons, I find I'm in need of a diff-like engine for
JavaBeans graphs.  I need to take two of these graphs, each of whose nodes
could be equal or different, and construct a new graph that contains only
those paths containing nodes that are different.

This involves doing several things to Javabeans that it looks like BeanUtils
should be able to handle:

1. copy a bean, whether it's cloneable or not (handled)
2. compare two bean graphs for equality based solely on the property
descriptors (not handled?)
3. (finally) take in two graphs and build a third consisting of the
difference (not handled)

(1) is handled by BeanUtils.clone(Object).  I didn't see anything for
(2)--there is BeanComparator, but it depends on a *single* property, not all
the properties.  Obviously I could write something that loops over that, but
I thought I'd ask in case I'm missing something easier.  Finally, (3), it
seems to me, is not handled at all.

Is this the state of the union?  If so, and if I write this silly thing,
I'll contribute back (if anyone's interested).

Cheers,
Laird

Mime
View raw message