title: Compare objects of different classes using reflection
body: <p>I've got two objects with exactly the same attributes. Don't ask me why, this is generated code and I have to deal with this.</p>
  
  <pre><code>class Bean1 {
     int id;
  }
  
  class Bean2 {
     int id;
  }
  </code></pre>
  
  <p>I want to compare objects of each class without writing the compare code for each attribute. <a href="https://stackoverflow.com/questions/12147297/how-do-i-assert-equality-on-two-classes-without-an-equals-method">This thread</a> explains how to compare two objects but in my case this fails because they are not of instances of the same class.</p>
  
  <p>This code returns false:</p>
  
  <pre><code>EqualsBuilder.reflectionEquals(new Bean1(1), new Bean2(1));
  </code></pre>
  
  <p>Is there another way to comapre objects and ignore object classes?</p>