Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
class BodyTypeAdapter : ColumnAdapter<BodyType, Long> {
override fun encode(enumValue: BodyType): Long {
return enumValue.ordinal.toLong()
}
override fun decode(databaseValue: Long?): BodyType {
return BodyType.values()[databaseValue?.toInt() ?: BodyType.UNKNOWN.ordinal]
}
companion object {
val INSTANCE by lazy { BodyTypeAdapter() }
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.