1

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?

Community
  • 1
  • 1
CodeBlue
  • 14,631
  • 33
  • 94
  • 132
  • http://commons.apache.org/lang/api-2.4/org/apache/commons/lang/builder/EqualsBuilder.html Or do you want it to work recursively? – biziclop Jun 18 '12 at 16:01
  • @biziclop Yes, recursively. EqualsBuilder seems to have that ability. So thanks. – CodeBlue Jun 18 '12 at 16:08
  • Umm, I seem to have linked to an old version of the documentation but I can't change it now, so everyone be warned. – biziclop Jun 18 '12 at 16:11

0 Answers0