Fixed
Status Update
Comments
fs...@gmail.com <fs...@gmail.com> #2
I've just tried a simple workaround whereby I return the types contained within the library inside an object via a bootstrap call. That doesn't work - no error message but the debugger drops out when stepping over code that references the types.
yb...@google.com <yb...@google.com> #3
Please share a spreadsheet that shows what you'd like to be able to do with libraries. You can share it with me at jkleinert AT google.com
de...@gmail.com <de...@gmail.com> #4
I've just shared a couple of spreadsheets with you.
yb...@google.com <yb...@google.com> #5
We have recently applied fixes adding the ability to step into library functions. If you still have an issue, please open a new report. Thank you.
yb...@google.com <yb...@google.com> #7
had a revert the change for a downsteram breakage. working on it.
Description
Version used: 1.0
Devices/Android versions reproduced on: NA
I have one entity that contains a set of enums. For example:
@Entity
data class Person(
@field:PrimaryKey val id: Int,
val name: String,
val favouriteDays: Set<Day>)
enum class Day {
MONDAY,
TUESDAY,
WEDNESDAY,
THURSDAY,
FRIDAY,
SATURDAY,
SUNDAY
}
I want to store this entity in a single table. In many cases, especially with enums, we could use a single bit mask to save the list as a number in the database.
Here's one example of what I wanted to do:
object DayCollectionTypeConverter {
@JvmStatic
@TypeConverter
fun daysConverter(days: Set<Day>): Int {
var value = 0
for (day in days) {
value += (1 shl day.ordinal)
}
return value
}
@JvmStatic
@TypeConverter
fun daysConverter(value: Int): Set<Day> {
val set = mutableSetOf<Day>()
for (day in Day.values()) {
if (value and 1 shl day.ordinal != 0) {
set.add(day)
}
}
return set
}
}
That code doesn't work as intended because @TypeConverter would allow me to convert one Day object, but not a collection (or set, list, etc) of Days.
I suggest a new annotation is created so the developer can specify how to save a Collection into a single column in the same table.