提交 | 用户 | age
|
302d2a
|
1 |
package com.platform.util; |
C |
2 |
|
|
3 |
import com.alibaba.fastjson.JSONObject; |
|
4 |
import com.platform.exception.PlatTipsException; |
|
5 |
import com.platform.resultTool.PlatformCode; |
|
6 |
import org.apache.poi.ss.formula.functions.T; |
|
7 |
|
|
8 |
import java.io.Serializable; |
|
9 |
|
|
10 |
/** |
|
11 |
* 类型转化工具 |
|
12 |
*/ |
|
13 |
public class FormatConversion { |
|
14 |
|
|
15 |
/** |
|
16 |
* @param data 转化的数据 |
|
17 |
* @param tClass 转化成的对象 |
|
18 |
* @return |
|
19 |
*/ |
|
20 |
public static Object jsonToEntity(String data,Class tClass) { |
|
21 |
try{ |
|
22 |
return JSONObject.parseObject(data, tClass); |
|
23 |
}catch (Exception e){ |
|
24 |
throw new PlatTipsException(PlatformCode.ERROR_BODY_DATA,"数据格式错误"); |
|
25 |
} |
|
26 |
} |
|
27 |
|
|
28 |
} |