| | |
| | | package com.yeshi.fanli.util.cache;
|
| | |
|
| | | import java.util.ArrayList;
|
| | | import java.util.List;
|
| | |
|
| | | import com.google.gson.Gson;
|
| | |
|
| | | import net.sf.json.JSONArray;
|
| | |
|
| | | public class ObjectCacheUtil<T> {
|
| | |
|
| | | // public T getObj( String value) {
|
| | | // return new Gson().fromJson(value, Class<T>);
|
| | | // }
|
| | | //
|
| | | // public List<T> getObjList(String value) {
|
| | | // List<T> list = new ArrayList<>();
|
| | | // JSONArray array = JSONArray.fromObject(value);
|
| | | // for (int i = 0; i < array.size(); i++) {
|
| | | // list.add(new Gson().fromJson(array.optJSONObject(i).toString(), T));
|
| | | // }
|
| | | // return list;
|
| | | // }
|
| | |
|
| | | }
|
| | | package com.yeshi.fanli.util.cache; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | |
| | | import com.google.gson.Gson; |
| | | |
| | | import net.sf.json.JSONArray; |
| | | |
| | | public class ObjectCacheUtil<T> { |
| | | |
| | | // public T getObj( String value) { |
| | | // return new Gson().fromJson(value, Class<T>); |
| | | // } |
| | | // |
| | | // public List<T> getObjList(String value) { |
| | | // List<T> list = new ArrayList<>(); |
| | | // JSONArray array = JSONArray.fromObject(value); |
| | | // for (int i = 0; i < array.size(); i++) { |
| | | // list.add(new Gson().fromJson(array.optJSONObject(i).toString(), T)); |
| | | // } |
| | | // return list; |
| | | // } |
| | | |
| | | } |