DaoReturnTypeConverters



Specifies the classes that contain DAO return type converters that a RoomDatabase can use.

This annotation is used to register converter classes that contain methods annotated with DaoReturnTypeConverter via annotating a Database or Dao.

All Dao methods in that database will be able to use the converters. These converters allow you to wrap or transform the result of a DAO method into a custom Kotlin return type (e.g., Result<MyEntity>, Result<List<MyEntity>>).

Important Distinction from TypeConverters:

Unlike TypeConverters, which convert any query result column to be converted to a field/property regardless if the field or property is on an entity or a data object class for storage, DaoReturnTypeConverters only applies to the return value of a DAO method. They are designed specifically to intercept the return value of a query or the result of a write operation.

Summary

Public constructors

DaoReturnTypeConverters(vararg value: KClass<*>)
Cmn

Public properties

Array<KClass<*>>

The list of DAO return type converter classes.

Cmn

Public constructors

DaoReturnTypeConverters

DaoReturnTypeConverters(vararg value: KClass<*> = [])

Public properties

value

val valueArray<KClass<*>>

The list of DAO return type converter classes. If converter methods are not static, Room will create an instance of these classes.

Returns
Array<KClass<*>>

The list of classes that contains the converter methods.