1
對於我的Genson配置,我使用了UrlQueryParamFilter
。它有效,但不是我所期望的。
我的實體:Genson:在使用RuntimePropertyFilter時處理孩子的財產
public class Root {
private String firstRootProp;
private String secondRootProp;
private List<Child> childs;
//getters & setters
}
public class Child {
private String firstChildProp;
private String secondChildProp;
//getters & setters
}
「rootEntity」 端點綁定到得到一些Root
instatnce在我休息的服務。 當我得到http://<host>/myservice/rootEntity?filter=childs
我感到遺憾的是會得到所有孩子的所有孩子的財產。但實際上我只拿到了孩子的結構:
{
"childs": [
{},
{}
]
}
而我想:
{
"childs": [
{
"firstChildProp": "Some value for first property",
"secondChildProp": "And some value for second property"
},
{
"firstChildProp": "Some value for first property",
"secondChildProp": "And some value for second property"
}
]
}
我怎樣才能解決呢?
Thx。