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>

Summary

Public constructors

ConstructedBy(value: KClass<*>)
Cmn
android
N

Public properties

KClass<*>

The 'expect' declaration of an 'object' that implements androidx.room.RoomDatabaseConstructor and is able to instantiate a androidx.room.RoomDatabase.

Cmn
android
N

Public constructors

ConstructedBy

ConstructedBy(value: KClass<*>)

Public properties

value

val valueKClass<*>

The 'expect' declaration of an 'object' that implements androidx.room.RoomDatabaseConstructor and is able to instantiate a androidx.room.RoomDatabase.