Android 如何忽略房间实体不需要的键

Android 如何忽略房间实体不需要的键,android,json,android-room,Android,Json,Android Room,我正在尝试创建一个房间实体类。但是有一些json对象我不需要。因此,我不知道如何忽略这些对象 以下是JSON: { "batchcomplete":true, "continue":{ "gpsoffset":10, "continue":"gpsoffset||" }, "query":{ "redirects":[ {

我正在尝试创建一个房间实体类。但是有一些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;
    }
}
@实体(tableName=“ResponseEntity”)
公共类PageDetailEntity{
@PrimaryKey(自动生成=真)
@ColumnInfo(name=“id”)
私有int-id;
@忽略
@ColumnInfo(name=“batchcomplete”)
私有布尔批处理完成;
@忽略
@类型转换器(ContinueModelConverter.class)
公共列表继续;
@类型转换器(QueryModelConverter.class)
私有ListqueryModel;
公共int getId(){
返回id;
}
公共无效集合id(内部id){
this.id=id;
}
公共布尔值isBatchcomplete(){
返回批量完成;
}
public void setBatchcomplete(布尔值batchcomplete){
this.batchcomplete=batchcomplete;
}
公共列表getmContinue(){
返回mContinue;
}
公共void setmContinue(列表mContinue){
this.mContinue=mContinue;
}
公共列表getQueryModel(){
返回查询模型;
}
公共void setQueryModel(列表queryModel){
this.queryModel=queryModel;
}
}

我只需要页面数组。有人可以指导我如何创建仅包含房间页面数组的实体类。

您可以使用来自的
@Ignore
注释

import android.arch.persistence.room.Ignore
文件室将不会保留用
@Ignore
注释的字段

@Ignore
public String name;