Android入门Sugar ORM

时间:2015-04-21 14:54:39

标签: android sugarorm

我是SugarORM的新手,我想将这个库用于我的应用程序。设置此库元标记后,我必须为所有类扩展SugarRecord,对于此操作,我将创建新类作为此样本的产品

@Table
public class ProductTable {
    private String id;
    private String count;

    public ProductTable() {
    }

    public ProductTable(String id, String count) {
        this.id = id;
        this.count = count;
    }

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getCount() {
        return count;
    }

    public void setCount(String count) {
        this.count = count;
    }
}

并且对于Extend SugarRecord,我希望将课程作为此示例:

public class ProductModel extends SugarRecord<ProductModel> {
    String title;
    String edition;

    public ProductModel(){
    }

    public ProductModel(String title, String edition){
        this.title = title;
        this.edition = edition;
    }
}

但是我收到了这个错误:

Error:(9, 46) java: type com.orm.SugarRecord does not take parameters

这一行:

public class ProductModel extends SugarRecord<ProductModel> {

我正在使用此Document

1 个答案:

答案 0 :(得分:3)

您不必再延长SugarRecord<ProductModel>,只需SugarRecord即可。