我正在尝试创建一个房间实体类。但是有一些JSON对象我不需要。所以我很困惑如何忽略这些对象。
下面是JSON:
{
"batchcomplete":true,
"continue":{
"gpsoffset":10,
"continue":"gpsoffset||"
},
"query":{
"redirects":[
{
"index":4,
"from":"Sachin Tyagi",
"to":"Solhah Singaarr"
},
{
"index":3,
"from":"Sachin The Film",
"to":"Sachin: A Billion Dreams"
}
],
"pages":[
{
"pageid":57570,
"ns":0,
"title":"Sachin Tendulkar",
"index":1,
"thumbnail":{
"source":"https://upload.wikimedia.org/wikipedia/commons/thumb/2/25/Sachin_Tendulkar_at_MRF_Promotion_Event.jpg/50px-Sachin_Tendulkar_at_MRF_Promotion_Event.jpg",
"width":50,
"height":45
},
"terms":{
"description":[
"Indian cricketer"
]
}
}
我也试过使用@ignore,但这对我不起作用。
这是我的实体类:
@Entity(tableName = "ResponseEntity")
public class PageDetailEntity {
@PrimaryKey(autoGenerate = true)
@ColumnInfo(name = "id")
private int id;
@Ignore
@ColumnInfo(name = "batchcomplete")
private boolean batchcomplete;
@Ignore
@TypeConverters(ContinueModelConverter.class)
public List<ContinueModel> mContinue;
@TypeConverters(QueryModelConverter.class)
private List<QueryModel>queryModel;
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public boolean isBatchcomplete() {
return batchcomplete;
}
public void setBatchcomplete(boolean batchcomplete) {
this.batchcomplete = batchcomplete;
}
public List<ContinueModel> getmContinue() {
return mContinue;
}
public void setmContinue(List<ContinueModel> mContinue) {
this.mContinue = mContinue;
}
public List<QueryModel> getQueryModel() {
return queryModel;
}
public void setQueryModel(List<QueryModel> queryModel) {
this.queryModel = queryModel;
}
}
我只需要页面数组。有人能指导我如何创建只有pages数组用于房间的实体类吗?