标签:des io ar sp java for on bs ad
String jsonStr="";
String content=jsonStr;
ObjectMapper objectMapper = new ObjectMapper();
objectMapper.configure(DeserializationConfig.Feature.ACCEPT_SINGLE_VALUE_AS_ARRAY, true);
JavaType javaType = objectMapper.getTypeFactory().constructParametricType(SearchResult.class,SearchProduct.class);
SearchResult<SearchProduct> searchResult = objectMapper.readValue(content, javaType);
List<ProductView> datas = new ArrayList<ProductView>();
for(SearchProduct product:searchResult.getResultList()){
}
public class SearchResult<T> {
private int totalItem;
private List<T> resultList;
public int getTotalItem() {
return totalItem;
}
public void setTotalItem(int totalItem) {
this.totalItem = totalItem;
}
public List<T> getResultList() {
return resultList;
}
public void setResultList(List<T> resultList) {
this.resultList = resultList;
}
}
标签:des io ar sp java for on bs ad
原文地址:http://www.cnblogs.com/yqlwl66/p/4111041.html