2017-03-16 94 views
0

的Java春RestTemplate行映射

ResponseEntity<PerfectPropsMatchClass> resp= restTemplate.getForEntity(url, PerfectPropsMatchClass.class) 
PerfectPropsMatchClass props = resp.getBody(); 

我不得不創建PerfectPropsMatchClass類B/C我PropsNotMatchClass並未有確切名稱爲返回的響應。有沒有一種有效的方式,我可以迭代每行響應並創建PropsNotMatchClass的對象。

+0

爲什麼不提取字符串類中的響應並迭代您正在查找的字段,然後創建類實例? – Coder

+0

是做這件事的一種優先方式嗎? –

+0

我會說有時候最好是最終看到它的方式 – Coder

回答