|
@@ -1,23 +0,0 @@
|
|
|
-package com.sheep.jiuyan.samllsheep.utils;
|
|
|
|
|
-
|
|
|
|
|
-import com.google.gson.Gson;
|
|
|
|
|
-
|
|
|
|
|
-import java.lang.reflect.Type;
|
|
|
|
|
-
|
|
|
|
|
-/**
|
|
|
|
|
- * Created by kemllor on 2017/12/15.
|
|
|
|
|
- */
|
|
|
|
|
-
|
|
|
|
|
-public class GsonUtil {
|
|
|
|
|
-
|
|
|
|
|
- public static <T> T getEntry(String jsonstr, Type type){
|
|
|
|
|
- Gson gson = new Gson();
|
|
|
|
|
- Object entry = gson.fromJson(jsonstr, type);
|
|
|
|
|
- return (T) entry;
|
|
|
|
|
- }
|
|
|
|
|
- public static <T> T getEntry(String jsonstr, Class<T> classOfT){
|
|
|
|
|
- Gson gson = new Gson();
|
|
|
|
|
- Object entry = gson.fromJson(jsonstr, (Type)classOfT);
|
|
|
|
|
- return (T) entry;
|
|
|
|
|
- }
|
|
|
|
|
-}
|
|
|