Alon Bar-Lev has posted comments on this change.

Change subject: engine: Add infrastructure code for removal of parameter classes
......................................................................


Patch Set 5:

(1 comment)

....................................................
File 
backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/utils/VdcParametersMap.java
Line 20:         VdcParameterValue.raiseExceptionIfInvalidObjectType(param, 
value);
Line 21:         paramsMap.put(param.getGuid(), new VdcParameterValue<T>(param, 
value));
Line 22:     }
Line 23: 
Line 24:     public <T> T get(VdcParameter<T> param) {
Please see the following... I get all functionality without using the explicit 
<> on use.

it is true that I will get casting exception when I use invalid type, but it is 
good as any exception we produce...

what important is that usage is simple...

what am I missing?

 public class a {

        public static class MyInteger {
                public MyInteger() {
                }
        }

        public static class Test1V {
                Class o;

                public Test1V(Class o) {
                        this.o = o;
                }

                public Object get() {
                        try {
                                return o.newInstance();
                        }
                        catch (Exception e) {
                                throw new RuntimeException(e);
                        }
                }
        }

        public static class Test1 {
                public <T> T get(Test1V v) {
                        return (T)v.get();
                }
        }

        public static void main (String args[]) throws Exception {
                Test1 t = new Test1();
                String x = t.get(new Test1V(String.class));
                MyInteger y = t.get(new Test1V(MyInteger.class));
                Object o1 = t.get(new Test1V(String.class));
                Object o2 = t.get(new Test1V(MyInteger.class));
        }
 }
Line 25:         return get(param, param.getJavaType());
Line 26:     }
Line 27: 
Line 28:     /**


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

Gerrit-MessageType: comment
Gerrit-Change-Id: I6a0970e492c0eff561888a46b02e47645ff68fc3
Gerrit-PatchSet: 5
Gerrit-Project: ovirt-engine
Gerrit-Branch: master
Gerrit-Owner: Ravi Nori <rn...@redhat.com>
Gerrit-Reviewer: Alon Bar-Lev <alo...@redhat.com>
Gerrit-Reviewer: Barak Azulay <bazu...@redhat.com>
Gerrit-Reviewer: Liran Zelkha <lzel...@redhat.com>
Gerrit-Reviewer: Ravi Nori <rn...@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