I have several Model objects (CateogryModel, MenuModel, OrderModel etc). I'm now trying to implement a local database and decided on using Requery.
In their docs, they mention:
getter, setters, equals & hashCode automatically generated into Person.java
So let's assume I already have Person.java with the following:
private class Person
{
int id;
String name;
//getter setter
}
and I change it to:
@Entity
abstract class Person
{
@Key @Generated
int id;
@Index("name")
String name;
}
What will happen? Where will my getters and setters go? Will requery generate a new class when I build the app?
When you build the project, Requery will generate the PersonEntity class in app/build/generated folder with same package name as Person class.
from API docs:
/**
* @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.
*/
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.