Realm 处理List<String> 问题 Type parameter 'java.lang.String' is not within its bound; should implement 'io.realm.RealmModel

public class InitAppBean extends RealmObject {
    private String sapling;
    private String logistics;
    private RealmList<DeliverTypeListBean> deliverTypeList;
    private RealmList<RealmString> countryList;

    public String getSapling() {
        return sapling;
    }

    public void setSapling(String sapling) {
        this.sapling = sapling;
    }

    public String getLogistics() {
        return logistics;
    }

    public void setLogistics(String logistics) {
        this.logistics = logistics;
    }

    public List<DeliverTypeListBean> getDeliverTypeList() {
        return deliverTypeList;
    }

    public void setDeliverTypeList(RealmList<DeliverTypeListBean> deliverTypeList) {
        this.deliverTypeList = deliverTypeList;
    }

    public RealmList<RealmString> getCountryList() {
        return countryList;
    }

    public void setCountryList(RealmList<RealmString> countryList) {
        this.countryList = countryList;
    }

  新创建String类继承RealmObject

public class RealmString extends RealmObject {
    private String val;

    public String getValue() {
        return val;
    }

    public void setValue(String value) {
        this.val = value;
    }
}

  

posted on 2019-01-02 10:32  freexiaoyu  阅读(1313)  评论(0编辑  收藏  举报