Details
-
Improvement
-
Status: Closed
-
Minor
-
Resolution: Fixed
-
2.4
-
None
Description
I use EqualsBuilder a lot in equals methods for POJOs and sometimes in utility methods to compare properties in DAOs. These methods get called a lot in my apps, and I would prefer to reuse an instance of EqualsBuilder instead of creating a new instance every time the methods are called. In one method, where I retrieve data from a database, a comparison method could be called thousands of times in a second. Yes, I have been careful about being threadsafe in my reuse of a single EqualsBuilder instance.
The problem is that (as I understand it), once an instance of EqualsBuilder has set isEquals to false, it stays false and all comparisons thereafter return false whether equal or not. I have overriden the setEquals() method to be public and call this before I start the comparison in my methods and this allows me to reuse EqualsBuilder.
I believe setEquals() should be changed to be public in EqualsBuilder as others surely use it in a similar manner.