甚至可以将根对象与超级字段绑定吗?
我有相当复杂的实体(实体)要绑定。我已经迷失了:)
这是我的代码情况:
public class CoreRestWrapper {
private Integer page;
private Integer perPage;
}
public class UserWrapper extends CoreRestWrapper {
private Collection<UserCVO> users;
}
public class UserCVO {
private UserVO userVO;
private Map<String, UserMeta> meta;
}
public class UserVO extends BaseVO {
//nothing here
}
public class BaseVO {
private Integer id;
private String mainName;
}
public class UserMeta extends Meta {
//nothing here
}
public class Meta {
private String key;
private Object value;
private String type; //String, Integer, Boolean, Date
}
UserWrapper 是我的根对象。我想让我的响应 xml 看起来像这样:
<users>
<page>1</page>
<perPage>2</perPage>
<user>
<id>1</id>
<main>test</main>
<meta type="String" key="wtf">just for fun</meta>
<meta type="Integer" key="age">99</meta>
</user>
<user>
<id>2</id>
<main>test</main>
<meta type="String" key="wtf">fooooo</meta>
<meta type="Integer" key="age">101</meta>
</user>
</users>
或者甚至可能<users page="1" perPage="2">
只是用户标签......
这甚至可能吗(对于 JiBX 的初学者来说)?