Android 的重新查询是否会自动生成 类?
Does Requery for Android autogenerate classes?
我有几个模型对象(CateogryModel、MenuModel、OrderModel 等)。我现在正在尝试实现本地数据库并决定使用 Requery。
在他们的文档中,他们提到:
getter, setters, equals & hashCode automatically generated into 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;
}
会发生什么?我的 getter 和 setter 会去哪里?当我构建应用程序时,重新查询会生成一个新的 class 吗?
当您构建项目时,Requery 将在 app/build/generated 文件夹中生成与 Person class 相同包名的 PersonEntity class。
来自 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.
*/
我有几个模型对象(CateogryModel、MenuModel、OrderModel 等)。我现在正在尝试实现本地数据库并决定使用 Requery。
在他们的文档中,他们提到:
getter, setters, equals & hashCode automatically generated into 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;
}
会发生什么?我的 getter 和 setter 会去哪里?当我构建应用程序时,重新查询会生成一个新的 class 吗?
当您构建项目时,Requery 将在 app/build/generated 文件夹中生成与 Person class 相同包名的 PersonEntity class。
来自 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.
*/