Android 入门 Sugar ORM

标签 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

最佳答案

您不必扩展 SugarRecord<ProductModel>不再是SugarRecord会做的。

关于Android 入门 Sugar ORM,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29775796/

相关文章:

java - 在现有数据库中创建表 sqlite sugar orm

android - 没有这样的表 Sugar ORM

java - 如何使用 ConnectableObservable 预取然后将处理后的数据用于不同的订阅者

android - 英语而不是 Geocoder 的本地语言

android - Activity 泄露了 IntentReceiver

java - 小部件 Onclick 不起作用

android - ContentResolver 是否通知所有路径变体?

android - Android 版 Sugar ORM 找不到我的列名

android - 来自多个表的 SugarORM 查询?