Allon Mureinik has posted comments on this change.

Change subject: core: Introducing Business Entity comparators
......................................................................


Patch Set 1: (2 inline comments)

....................................................
File 
backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/BusinessEntityComparator.java
Line 5: 
Line 6: /**
Line 7:  * Generic for implementing a business entity comparator based on ID 
comparison
Line 8:  */
Line 9: public class BusinessEntityComparator<T extends BusinessEntity<ID>, ID 
extends Serializable & Comparable<? super ID>> implements Comparator<T> {
As a good defensive practice, I suggest making the comperator serializable.
Line 10: 
Line 11:     @Override
Line 12:     public int compare(T o1, T o2) {
Line 13:         return o1.getId().compareTo(o2.getId());


Line 13:         return o1.getId().compareTo(o2.getId());
Line 14:     }
Line 15: 
Line 16:     public static <T extends BusinessEntity<ID>, ID extends 
Serializable & Comparable<? super ID>> BusinessEntityComparator<T, ID> 
newInstance() {
Line 17:         return new BusinessEntityComparator<T, ID>();
Since comperators are stateless, I'd suggest holding a cached static instance, 
instead of re-creating them all the time.
Line 18:     }


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

Gerrit-MessageType: comment
Gerrit-Change-Id: I979cb7d2273c2eaaa2866dcb4a5f760e9266e11a
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-engine
Gerrit-Branch: master
Gerrit-Owner: Yair Zaslavsky <yzasl...@redhat.com>
Gerrit-Reviewer: Allon Mureinik <amure...@redhat.com>
_______________________________________________
Engine-patches mailing list
Engine-patches@ovirt.org
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to