Possible Duplicate:
Is there a Java reflection utility to do a deep comparison of two objects?
I want to create a generic object comparison method like this -
public static boolean objectsAreEqual(Object A, Object B)
{
// ensure objects belong to the same class
// compare object fields via reflection
// if all fields match, then return true else return false
}
Is there an existing implementation for this?