我已经创建了以下restful jersy客户端返回的对象数组,它可以工作,但它返回字符串值,我已将其更改为hgson但在此行中收到以下错误
ScoreRouteRulefile scoreRouteRulefile=scoreRouteRulefiles.get(i);
java.lang.ClassCastException:com.google.gson.internal.LinkedTreeMap无法强制转换为com.innvo.drools.ScoreRouteRulefile
Client client = Client.create();
WebResource webResource = client
.resource("http://localhost:8080/adap/api/getQuery/"+filterId);
ClientResponse response = webResource.accept("application/json")
.get(ClientResponse.class);
String output = response.getEntity(String.class);
Type listType = new TypeToken<List>() {}.getType();
List<ScoreRouteRulefile> scoreRouteRulefiles = new Gson().fromJson(output, listType);
for(int i=0;i<scoreRouteRulefiles.size();i++){
ScoreRouteRulefile scoreRouteRulefile=scoreRouteRulefiles.get(i);
}