package com.hxsmart.intelligentizepos.util;
import com.google.gson.Gson;
/**
* Developer : xiongwenwei@aliyun.com
* Create Time :2016-5-23 17:49:45
* Function:将json字符串转为JavaBean
*/
public class BeanUtil {
private static Gson gson = null;
static {
if (gson == null) {
gson = new Gson();
}
}
/**
* 将json转为bean
* @param jsonString
* @param cls
* @return bean
*/
public static <T> T getBean(String jsonString, Class<T> cls) {
T t = null;
if (gson != null) {
t = gson.fromJson(jsonString, cls);
}
return t;
}
}