Moti Asayag has posted comments on this change.

Change subject: tools: Remove cumbersome NotificationMethod abstraction.
......................................................................


Patch Set 11:

(1 comment)

....................................................
File 
backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/EventNotificationMethod.java
Line 6: public enum EventNotificationMethod {
Line 7:     EMAIL(0);
Line 8: 
Line 9:     private int intValue;
Line 10:     private static Map<Integer, EventNotificationMethod> mappings;
and yet - having a map for 2 elements only is an over-kill.

the implementation of forValue will look like: 

  
public static EventNotificationMethod forValue(int id) {
    switch (id) {
        case 0: return EMAIL;
        case 1: return SNMP_TRAP;
        default:
              throw new IllegalArgumentException("Unsupported event 
notification method value: " + value);
     }
  }

and you save 7 code lines and some bytes from the heap.

Yair ?
Line 11: 
Line 12:     static {
Line 13:         mappings = new HashMap<Integer, EventNotificationMethod>();
Line 14:         for (EventNotificationMethod value : values()) {


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

Gerrit-MessageType: comment
Gerrit-Change-Id: I8b71c4e78bbdca3d02d2ac4ef419b9d3d7d58761
Gerrit-PatchSet: 11
Gerrit-Project: ovirt-engine
Gerrit-Branch: master
Gerrit-Owner: mooli tayer <mta...@redhat.com>
Gerrit-Reviewer: Barak Azulay <bazu...@redhat.com>
Gerrit-Reviewer: Eli Mesika <elimes...@gmail.com>
Gerrit-Reviewer: Juan Hernandez <juan.hernan...@redhat.com>
Gerrit-Reviewer: Martin Peřina <mper...@redhat.com>
Gerrit-Reviewer: Moti Asayag <masa...@redhat.com>
Gerrit-Reviewer: Yair Zaslavsky <yzasl...@redhat.com>
Gerrit-Reviewer: Yaniv Bronhaim <ybron...@redhat.com>
Gerrit-Reviewer: mooli tayer <mta...@redhat.com>
Gerrit-Reviewer: oVirt Jenkins CI Server
Gerrit-HasComments: Yes
_______________________________________________
Engine-patches mailing list
Engine-patches@ovirt.org
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to