ConstructedBy
@Target(allowedTargets = [AnnotationTarget.CLASS])
@Retention(value = AnnotationRetention.BINARY)
public annotation ConstructedBy
Defines the androidx.room.RoomDatabaseConstructor that will instantiate the Room generated implementation of the annotated Database.
A androidx.room.RoomDatabase database definition must be annotated with this annotation if it is located in a common source set on a Kotlin Multiplatform project such that at runtime the implementation generated by the annotation processor can be used. The value must be an 'expect object' that implements androidx.room.RoomDatabaseConstructor.
Example usage:
@Database(version = 1, entities = [Song::class, Album::class])
@ConstructedBy(MusicDatabaseConstructor::class)
abstract class MusicDatabase : RoomDatabase
expect object MusicDatabaseConstructor : RoomDatabaseConstructor<MusicDatabase>
| See also | |
|---|---|
RoomDatabaseConstructor |
Summary
Public constructors |
|---|
ConstructedBy(@NonNull KClass<@NonNull ?> value) |
Public methods |
|
|---|---|
final @NonNull KClass<@NonNull ?> |
getValue()The 'expect' declaration of an 'object' that implements |
Public constructors
Public methods
getValue
public final @NonNull KClass<@NonNull ?> getValue()
The 'expect' declaration of an 'object' that implements androidx.room.RoomDatabaseConstructor and is able to instantiate a androidx.room.RoomDatabase.