Alona Kaplan has posted comments on this change. Change subject: webadmin: removed caching from EnumTranslator. ......................................................................
Patch Set 1: (3 comments) http://gerrit.ovirt.org/#/c/26048/1//COMMIT_MSG Commit Message: Line 7: webadmin: removed caching from EnumTranslator. Line 8: Line 9: org.ovirt.engine.ui.uicompat.Translator changed to be generic. Line 10: Line 11: org.ovirt.engine.ui.uicompat.EnumTranslator extends generic Translator using Enum<?> as type parameter. Doing so there's guarantee that only enum values are passed to 'get' method, which removed the need to instantiate EnumTranslator with Class<?> type, because passed 'key' parameter will always have same (class) type as 'type' field. Please format the comment. Line 12: Line 13: Two static factories in EnumTranslator removed and replace by default constructor. Line 14: Line 15: Note that key to access resourcebundle is calculated from Enum.getDeclaringClass() and not Enum.getClass(); when using polymorphic enum name your resourcebundle keys appropriately. Line 14: Line 15: Note that key to access resourcebundle is calculated from Enum.getDeclaringClass() and not Enum.getClass(); when using polymorphic enum name your resourcebundle keys appropriately. Line 16: Line 17: Change-Id: I3df424d8e7a35ed249b2760da79deba7db31b785 Line 18: Bug-Url: https://bugzilla.redhat.com/?????? If you don't have a bug-url remove this line from the comment. http://gerrit.ovirt.org/#/c/26048/1/frontend/webadmin/modules/uicompat/src/main/java/org/ovirt/engine/ui/uicompat/EnumTranslator.java File frontend/webadmin/modules/uicompat/src/main/java/org/ovirt/engine/ui/uicompat/EnumTranslator.java: Line 11: Line 12: private Enums enums = GWT.create(Enums.class); Line 13: Line 14: @Override Line 15: public String get(Enum<?> key) { You can remove the inheritance from translator and make this method static. So you won't need to create any instances of EnumTranslator. Line 16: try { Line 17: //FIXME: hack: due to java restriction for method names with chars that are not letters, digits, and underscores, replace . with 0 Line 18: if(key == null){ Line 19: return null; -- To view, visit http://gerrit.ovirt.org/26048 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I3df424d8e7a35ed249b2760da79deba7db31b785 Gerrit-PatchSet: 1 Gerrit-Project: ovirt-engine Gerrit-Branch: master Gerrit-Owner: Martin Mucha <[email protected]> Gerrit-Reviewer: Alona Kaplan <[email protected]> Gerrit-Reviewer: [email protected] Gerrit-Reviewer: oVirt Jenkins CI Server Gerrit-HasComments: Yes _______________________________________________ Engine-patches mailing list [email protected] http://lists.ovirt.org/mailman/listinfo/engine-patches
