1. 程式人生 > >Realm 處理List<String> 問題 Type parameter 'java.lang.String' is not within its bound; should implement 'io.realm.RealmModel

Realm 處理List<String> 問題 Type parameter 'java.lang.String' is not within its bound; should implement 'io.realm.RealmModel

class etc tap obj sap mob ava get not

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;
    }
}

  

Realm 處理List<String> 問題 Type parameter 'java.lang.String' is not within its bound; should implement 'io.realm.RealmModel