繁体   English   中英

Android的Requery是否会自动生成类?

[英]Does Requery for Android autogenerate classes?

我有几个模型对象(CateogryModel,MenuModel,OrderModel等)。 我现在正在尝试实现本地数据库,并决定使用Requery。

他们在文档中提到:

getter,setter,equals和hashCode自动生成到Person.java中

因此,假设我已经拥有带有以下内容的Person.java:

private class Person
{
    int id;
    String name;

    //getter setter
}

我将其更改为:

@Entity
abstract class Person
{
    @Key @Generated
    int id;

    @Index("name")
    String name;
}

会发生什么? 我的吸气器和吸气器会去哪里? 构建应用程序时,重新查询会生成一个新类吗?

当您构建项目时,Requery将在app / build / generated文件夹中生成PersonEntity类,其包名称与Person类相同。

来自API文档:

 /**
 * @return the desired Entity name for the type. This class will be generated by the processor
 * in the same package as the type the annotation is placed on. This name is also used as the
 * table name unless a {@link Table} attribute is specified with a different name.
 * Defaults to empty, the processor will remove "Abstract" prefix from the class name if it
 * exists.
 */

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM