inline fun <reified T> mapToBean(map: MutableMap<String, Any>): T {
val gson = getJsonInit()
val jsonStr = gson.toJson(map)
return gson.fromJson(jsonStr,T::class.java)
}
//获取json的初始化方式
fun getJsonInit(): Gson {
val jsonBuild = GsonBuilder()
//加上这行可以过滤服务器返回的null
jsonBuild.serializeNulls()
return jsonBuild.create()
}