ObjectMapper 使用1
直接上代码了,呵呵
ObjectMapper mapper = new ObjectMapper();
LinkedHashMap<String, Object> elem = new LinkedHashMap<String, Object>();
elem.put("ucid", 100);
elem.put("usetime", "2013-11-13 10:02:02");
elem.put("usemoney", "66.66");
elem.put("orderid", "767865676");
couponCb = mapper.convertValue(elem, UlCouponCb.class);
Integer id = couponCb.getUcid();
System.out.println("result:"+id);
System.out.println("usetime:"+couponCb.getUsetime());
System.out.println("usemoney:"+couponCb.getUsemoney());
System.out.println("orderid:"+couponCb.getOrderid());
不细说了,有空补上.