Dhanya S Pillai
04/07/2021, 11:45 AMRoukanken
04/07/2021, 11:48 AMDhanya S Pillai
04/07/2021, 11:49 AMreturn Gson().fromJson(databaseValue, object : TypeToken<UserProfile?>() {}.type)
Dhanya S Pillai
04/07/2021, 11:49 AMRoukanken
04/07/2021, 11:49 AMdatabaseValue
?Dhanya S Pillai
04/07/2021, 11:49 AMRoukanken
04/07/2021, 11:50 AMDhanya S Pillai
04/07/2021, 11:50 AMDhanya S Pillai
04/07/2021, 11:50 AMclass UserProfileConvertor : PropertyConverter<UserProfile, String> {
override fun convertToEntityProperty(databaseValue: String?): UserProfile? {
if (databaseValue == null) {
return null
}
return Gson().fromJson(databaseValue, object : TypeToken<UserProfile?>() {}.type)
}
override fun convertToDatabaseValue(entityProperty: UserProfile?): String? {
return if (entityProperty == null) null else Gson().toJson(entityProperty)
}
fun convertToDatabaseValue(user_profiles: MutableList<Any?>): String? {
return if (user_profiles == null) null else Gson().toJson(user_profiles)
}
}
Dhanya S Pillai
04/07/2021, 11:50 AMchristophsturm
04/07/2021, 11:51 AMchristophsturm
04/07/2021, 11:51 AMRoukanken
04/07/2021, 11:51 AMDhanya S Pillai
04/07/2021, 11:52 AMDhanya S Pillai
04/07/2021, 11:52 AMchristophsturm
04/07/2021, 11:55 AMchristophsturm
04/07/2021, 11:55 AMDhanya S Pillai
04/07/2021, 11:56 AMDhanya S Pillai
04/07/2021, 11:56 AMchristophsturm
04/07/2021, 11:57 AMreturn Gson().fromJson("", object : TypeToken<UserProfile?>() {}.type)
christophsturm
04/07/2021, 11:57 AMDhanya S Pillai
04/07/2021, 11:58 AM