tags:

views:

28

answers:

1

I am looking for an efficient (code-wise, and runtime-wise) means to identify whether a JavaBean object has changed.

I was thinking of holding a clone of the class that could be compared on demand to the class instance. This is similar to the strategy used by CSLA.net.

The question is, is there already a means to achieve this using native JRE JavaBeans, or with the addition of some library (Apache commons BeanUtils?) or, even by adding the constraint of JEE6 EJB's.

Ideas and theories both welcome...

+1  A: 

bean-properties might have something helpful (although it's not JavaBean strictly speaking). Otherwise you can add a call to a notifyPropertyChanged(..) method from each setter - it's ugly, though.

Bozho
I have not tried it yet, but it looks promising although some of the implementation may end up conflicting with other things. I will post my experiences on this sometime within the next few weeks.
cmdematos