//Calculate other chargeslist<qitafree> qitafreelist = Gsonutils.getgson (). Fromjson (Exhimain.getqitafressjson (),NewTypetoken<list<qitafree>>() {}.gettype ()); Exhimain.setqitafrees (qitafreelist);//other if(Qitafreelist! =NULL&& qitafreelist.size () >0){ for(Qitafree qitafree:qitafreelist) {if("1". Equals (Qitafree.getcaltype ())) {//1 indicates the unit calculationOthercharges = (Long) (Othercharges +Qitafree.getprice ()); }Else if("2". Equals (Qitafree.getcaltype ())) {//indicated by the booth areaOthercharges = othercharges + Math.Round (qitafree.getprice () *Zhanarea); } } }//Calculate other charges end
This Gsonutils.getgson (). Fromjson (Exhimain.getqitafressjson (), New typetoken<list<qitafree>> () when you turn the generic type into a collection. {}.gettype ());
If such as this turn list<string> fanlist = Gsonutils.getgson (). Fromjson (Exhimain.getfanwei (), arraylist.class); It doesn't work.
Gsonutils.getgson (). Fromjson () Turn generic collection usage