Gosn Util
来源:互联网 发布:落叶知多少是哪首诗 编辑:程序博客网 时间:2024/06/07 18:03
package common.util;import java.lang.reflect.Type;import java.math.BigDecimal;import java.util.Date;import com.google.gson.Gson;import com.google.gson.GsonBuilder;public final class JsonUtil {/** * @Fields gson : TODO 初始化 序列化工具 */ private static Gson gson = new GsonBuilder().registerTypeAdapter(Long.class, new LongAdapter()).registerTypeAdapter(Date.class, new DateAdapter()).registerTypeAdapter(BigDecimal.class, new BigDecimalAdapter()).create();/** * @Description: TODO 将 Object 序列化为 Json 字符串 * @param @param obj * @param @return * @return * @throws */public static String toJson(Object obj) {return gson.toJson(obj);}/** * @Description: TODO 将 Json 字符串序列化成 Object * @param @param str * @param @param clazz * @param @return * @return * @throws */public static Object fromJson(String str, Class<?> clazz) {return gson.fromJson(str, clazz);} public static <T> T fromJson(String str, Type type) { return gson.fromJson(str, type);}}
阅读全文
0 0
- Gosn Util
- Gosn 使用
- gosn 解析
- java - Gosn 后台解析
- gosn解析集合
- Gosn的使用
- gosn混淆文件书写
- Gosn解析Json数组
- Authentic Louis Vuitton Sunglasses 4GOSN
- util
- Util
- Util
- util
- util
- util
- util
- util
- Util
- WebApi 接口参数不再困惑:传参详解
- oracle 数据泵 network link使用
- 将博客搬至CSDN
- CSS white-space 属性
- C++服务器洗牌
- Gosn Util
- [js点滴]JavaScript之cookie技术
- js页面加载触发的事件 document.write 和document.onload的区别
- 磁盘镜像工具Guymager
- Linux守护进程的深入理解
- go学习之runtime
- 刷清橙OJ--A1047.做明智的消费者
- String 类的equal 和 == 的区别?
- 静态成员