Uploaded image for project: 'Commons Lang'
  1. Commons Lang
  2. LANG-466

Please expose setEquals(boolean) as public so EqualsBuilder instances can be reused

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • 2.4
    • 2.5
    • lang.builder.*
    • 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.

      Attachments

        Activity

          People

            Unassigned Unassigned
            developer dude Lauren Bish
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: