可能重复:
Is there a Java reflection utility to do a deep comparison of two objects?
我想创建一个像这样的通用对象比较方法 -
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
}
是否有现成的实施?