package androidx.room /** * Marks a class as an entity. This class will have a mapping SQLite table in the database. * * * Each entity must have at least 1 field annotated with [PrimaryKey]. * You can also use [.primaryKeys] attribute to define the primary key. * * * Each entity must either have a no-arg constructor or a constructor whose parameters match * fields (based on type and name). Constructor does not have to receive all fields as parameters * but if a field is not passed into the constructor, it should either be public or have a public * setter. If a matching constructor is available, Room will always use it. If you don't want it * to use a constructor, you can annotate it with [Ignore]. * * * When a class is marked as an Entity, all of its fields are persisted. If you would like to * exclude some of its fields, you can mark them with [Ignore]. * * * If a field is `transient`, it is automatically ignored **unless** it is annotated with * [ColumnInfo], [Embedded] or [Relation]. * * * Example: *
* @Entity
* public class User {
* @PrimaryKey
* private final int uid;
* private String name;
* @ColumnInfo(name = "last_name")
* private String lastName;
*
* public User(int uid) {
* this.uid = uid;
* }
* public String getLastName() {
* return lastName;
* }
* public void setLastName(String lastName) {
* this.lastName = lastName;
* }
* }
*
*
* @see Dao
*
* @see Database
*
* @see PrimaryKey
*
* @see ColumnInfo
*
* @see Index
*/
@Target(AnnotationTarget.CLASS, AnnotationTarget.FILE)
@Retention(AnnotationRetention.BINARY)
annotation class Entity(
/**
* The table name in the SQLite database. If not set, defaults to the class name.
*
* @return The SQLite tableName of the Entity.
*/
val tableName: String = "",
/**
* List of indices on the table.
*
* @return The list of indices on the table.
*/
val indices: Array