[ad_1]
I am getting this error
error: Entities and POJOs must have a usable public constructor. You can have an empty constructor or a constructor whose parameters match the fields (by name and type). public enum Measurement {
the enum will simply be a way to store answers from a dropdown.
@Entity(tableName = "bottles")
data class Bottle(
@PrimaryKey (autoGenerate = true)
val consumableID: String,
@Embedded var prescription : Prescription?,
@Embedded var measurement: Measurement?,
@Embedded var reminder: Reminder?,
var quantityInBottle: Int?,
val expirationDate : Date?,
var startDate : Date?,
val cabinetID: String
)
enum class Measurement {
MILLIGRAMS,
SCOOP,
GRAMS,
OZ,
TSP,
TBS,
}
I have TypeConverters for measurement defined as
class MeasurementTypeConverters {
@TypeConverter
fun measurementToString(measurement: Measurement?) : String{
return measurement.toString()
}
@TypeConverter
fun stringToMeasurement(string: String) : Measurement{
return Measurement.valueOf(string)
}
}
[ad_2]