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.
class Bean1 {
int id;
}
class Bean2 {
int id;
}
I want to compare objects of each class without writing the compare code for each attribute. This thread explains how to compare two objects but in my case this fails because they are not of instances of the same class.
This code returns false:
EqualsBuilder.reflectionEquals(new Bean1(1), new Bean2(1));
Is there another way to comapre objects and ignore object classes?
Aucun commentaire:
Enregistrer un commentaire