Created
April 1, 2019 00:37
-
-
Save enginebai/3191009c8a7c884339e3dd2d152991e7 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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