commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Lauren Bish (JIRA)" <>
Subject [jira] Commented: (LANG-466) Please expose setEquals(boolean) as public so EqualsBuilder instances can be reused
Date Thu, 06 Nov 2008 21:43:44 GMT


Lauren Bish commented on LANG-466:

A reset() or resetEquals() method would work if it basically reset the isEquals var to true
as setEquals() does - or the equivalent result. Whatever it takes to allow code to reuse the
EqualsBuilder from one iteration to the next and thereby minimize object creation where it
isn't needed.

> Please expose setEquals(boolean) as public so EqualsBuilder instances can be reused
> -----------------------------------------------------------------------------------
>                 Key: LANG-466
>                 URL:
>             Project: Commons Lang
>          Issue Type: Improvement
>    Affects Versions: 2.4
>            Reporter: Lauren Bish
>            Priority: Minor
>             Fix For: 3.0
> 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.

This message is automatically generated by JIRA.
You can reply to this email to add a comment to the issue online.

View raw message