I am looking for a generic utility in Java, that can help me create a diff report for two objects (of the same type).
For instance, if my class structure is:
class A {
int p1;
string p2;
B b1;
}
class B {
float p3;
}
I want a report b/w two objects of type A (say, a1 and a2), as follows: a1 vs. a2
p1 : 'remove'
p2 : 'change'
b1.p3: 'add'
wherein, 'remove' is set if the property was null in the second object, 'change' if the properties were present but had different values, and 'add' if the property was null in the first object.
It may get tougher/trickier for collection objects...