Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
object NewPostFieldConvert {
@TypeConverter
fun postTypeToStr(type: PostType?): String? = type?.name
@TypeConverter
fun strToPostType(str: String?): PostType? = str?.let { PostType.valueOf(it) }
@TypeConverter
fun fileToPath(file: File?): String? = file?.absolutePath
@TypeConverter
fun pathToFile(path: String?): File? = path?.let { File(it) }
}
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.