Change in ovirt-engine[master]: core: Don't check equality in BE setters

amureini at redhat.com amureini at redhat.com
Sun Feb 3 20:44:31 UTC 2013


Allon Mureinik has submitted this change and it was merged.

Change subject: core: Don't check equality in BE setters
......................................................................


core: Don't check equality in BE setters

Some old business entities used the change-check idiom in their setters:

public void setXXX (Object newValue) {
    if (!newValue.equals(dataMember) {
        dataMember = newValue;
    }
}

This was probably produced by the C# conversion, but is completely
useless in Java - in any event, at the end of the setXXX method the
dataMember's value will be equal to the one passed, and the equality
check is more expensive than just assigning the new value.

This patch removes this old idiom from the code.
As a nice side-bonus, it also removes a couple of StringHelper usages
from the code, as part of the ongoing effort to get rid of this class.

Change-Id: Iafac9ca646c6c988470bf49d0596d973531c4616
Signed-off-by: Allon Mureinik <amureini at redhat.com>
---
M backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/DbUser.java
M backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/VmTemplate.java
M backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/storage_domains.java
M backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/vm_pools.java
4 files changed, 4 insertions(+), 15 deletions(-)

Approvals:
  Allon Mureinik: Verified; Looks good to me, approved


--
To view, visit http://gerrit.ovirt.org/11638
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: Iafac9ca646c6c988470bf49d0596d973531c4616
Gerrit-PatchSet: 3
Gerrit-Project: ovirt-engine
Gerrit-Branch: master
Gerrit-Owner: Allon Mureinik <amureini at redhat.com>
Gerrit-Reviewer: Alissa Bonas <abonas at redhat.com>
Gerrit-Reviewer: Allon Mureinik <amureini at redhat.com>
Gerrit-Reviewer: Daniel Erez <derez at redhat.com>
Gerrit-Reviewer: Liron Aravot <laravot at redhat.com>
Gerrit-Reviewer: Maor Lipchuk <mlipchuk at redhat.com>
Gerrit-Reviewer: Tal Nisan <tnisan at redhat.com>
Gerrit-Reviewer: Vered Volansky <vvolansk at redhat.com>



More information about the Engine-commits mailing list