Package org.nutz.lang.util

Examples of org.nutz.lang.util.NutType


        String json = "{'loginName' :'user1','body' :{'mobile' :'"
                      + mobil
                      + "'}, 'str':'"
                      + str
                      + "'}";
        Type type = new NutType(JsonRequest2.class, Employee2.class, String.class);
        JsonRequest2<Employee2, String> request = (JsonRequest2<Employee2, String>) Json.fromJson(type,
                                                                                                  json);
        assertEquals(request.body.mobile, mobil);
        assertEquals(request.str, str);
    }
View Full Code Here


        String json = "{'loginName' :'user1','body' :{'mobile' :'"
                      + mobil
                      + "'}, 'str':{'mobile' :'"
                      + str
                      + "'}}";
        Type type = new NutType(JsonRequest2.class, Employee2.class, Employee2.class);
        JsonRequest2<Employee2, Employee2> request = ((JsonRequest2<Employee2, Employee2>) Json.fromJson(type,
                                                                                                         json));
        assertEquals(request.body.mobile, mobil);
        assertEquals(request.str.mobile, str);
    }
View Full Code Here

        request.setPassword("1234");
        request.setVersion("1101");
        String json = Json.toJson(request);
        System.out.println(json);

        request = (JsonRequest<Employee>) Json.fromJson(new NutType(request.getClass(),
                                                                    Employee.class), json);
        System.out.println(request.getBody().getMobile());
    }
View Full Code Here

        request.setVersion("1101");
        request.setUserType(JsonRequest.USER_TYPE_EMPLOYEE);
        String json = Json.toJson(request);
        System.out.println(json);

        request = (JsonRequest<Record>) Json.fromJson(new NutType(request.getClass(),
                                                                  record.getClass()),
                                                      json);
        System.out.println(request.getBody().getString("a"));
        System.out.println(request.getBody().getInt("b"));
    }
View Full Code Here

        String json = "{'loginName' :'user1','body' :{'mobile' :'"
                      + mobil
                      + "'}, 'str':'"
                      + str
                      + "'}";
        Type type = new NutType(JsonRequest2.class,
                                Employee2.class,
                                String.class);
        JsonRequest2<Employee2, String> request = (JsonRequest2<Employee2, String>) Json.fromJson(type,
                                                                                                  json);
        assertEquals(request.body.mobile, mobil);
View Full Code Here

        String json = "{'loginName' :'user1','body' :{'mobile' :'"
                      + mobil
                      + "'}, 'str':{'mobile' :'"
                      + str
                      + "'}}";
        Type type = new NutType(JsonRequest2.class,
                                Employee2.class,
                                Employee2.class);
        JsonRequest2<Employee2, Employee2> request = ((JsonRequest2<Employee2, Employee2>) Json.fromJson(type,
                                                                                                         json));
        assertEquals(request.body.mobile, mobil);
View Full Code Here

        request.setPassword("1234");
        request.setVersion("1101");
        String json = Json.toJson(request);
        // System.out.println(json);

        request = (JsonRequest<Employee>) Json.fromJson(new NutType(request.getClass(),
                                                                    Employee.class),
                                                        json);
        // System.out.println(request.getBody().getMobile());
    }
View Full Code Here

        request.setVersion("1101");
        request.setUserType(JsonRequest.USER_TYPE_EMPLOYEE);
        String json = Json.toJson(request);
        // System.out.println(json);

        request = (JsonRequest<Record>) Json.fromJson(new NutType(request.getClass(),
                                                                  record.getClass()),
                                                      json);
        // System.out.println(request.getBody().getString("a"));
        // System.out.println(request.getBody().getInt("b"));
    }
View Full Code Here

        }
        if (types != null && types.length > 0 && type instanceof ParameterizedType) {
            ParameterizedType pt = (ParameterizedType) type;

            if (pt.getActualTypeArguments().length >= 0) {
                NutType nt = new NutType();
                nt.setOwnerType(pt.getOwnerType());
                nt.setRawType(pt.getRawType());
                Type[] tt = new Type[pt.getActualTypeArguments().length];
                for (int i = 0; i < tt.length; i++) {
                    tt[i] = types[i];
                }
                nt.setActualTypeArguments(tt);
                return nt;
            }
        }

        return type;
View Full Code Here

TOP

Related Classes of org.nutz.lang.util.NutType

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.